Skip to content

Instantly share code, notes, and snippets.

@Goston
Last active August 29, 2022 08:58
Show Gist options
  • Save Goston/16d8396c2f740df7cf43dcd4d67e8c1a to your computer and use it in GitHub Desktop.
Save Goston/16d8396c2f740df7cf43dcd4d67e8c1a to your computer and use it in GitHub Desktop.
vue-select Bootstrap / BootstrapVue css
<v-select class="form-control"
:class="{
'is-invalid': isValid === false ? true : undefined,
'is-valid': isValid ? true : undefined
}"
:options="['Canada', 'United States']">
</v-select>
:root {
--vs-colors--lightest: #ced4da;
--vs-colors--light: rgba(60, 60, 60, 0.5);
--vs-colors--dark: #495057;;
--vs-colors--darkest: rgba(0, 0, 0, 0.15);
--vs-search-input-color: inherit;
--vs-search-input-placeholder-color: inherit;
--vs-font-size: 1rem;
--vs-line-height: 1.85;
--vs-state-disabled-bg: transparent;
--vs-state-disabled-color: var(--vs-colors--light);
--vs-state-disabled-controls-color: var(--vs-colors--light);
--vs-state-disabled-cursor: default;
--vs-border-color: var(--vs-colors--lightest);
--vs-border-width: 1px;
--vs-border-style: solid;
--vs-border-radius: 4px;
--vs-actions-padding: 4px 10px 0 3px;
--vs-controls-color: #343a41;
--vs-controls-size: 0.8;
--vs-controls--deselect-text-shadow: 0 1px 0 #fff;
--vs-selected-bg: #f0f0f0;
--vs-selected-color: var(--vs-colors--dark);
--vs-selected-border-color: var(--vs-border-color);
--vs-selected-border-style: var(--vs-border-style);
--vs-selected-border-width: var(--vs-border-width);
--vs-dropdown-bg: #fff;
--vs-dropdown-color: inherit;
--vs-dropdown-z-index: 1000;
--vs-dropdown-min-width: 160px;
--vs-dropdown-max-height: 350px;
--vs-dropdown-box-shadow: 0px 3px 6px 0px var(--vs-colors--darkest);
--vs-dropdown-option-bg: #000;
--vs-dropdown-option-color: var(--vs-dropdown-color);
--vs-dropdown-option-padding: 3px 20px;
--vs-dropdown-option--active-bg: #5897fb;
--vs-dropdown-option--active-color: #fff;
--vs-dropdown-option--deselect-bg: #fb5858;
--vs-dropdown-option--deselect-color: #fff;
--vs-transition-timing-function: cubic-bezier(1, -0.115, 0.975, 0.855);
--vs-transition-duration: 150ms
}
.v-select {
font-family: inherit;
position: relative;
font-size: 1rem;
}
.v-select, .v-select * {
box-sizing: border-box;
}
:root {
--vs-transition-timing-function: cubic-bezier(1, 0.5, 0.8, 1);
--vs-transition-duration: 0.15s
}
@-webkit-keyframes vSelectSpinner {
0% {
transform: rotate(0deg)
}
to {
transform: rotate(1turn)
}
}
@keyframes vSelectSpinner {
0% {
transform: rotate(0deg)
}
to {
transform: rotate(1turn)
}
}
.vs__fade-enter-active, .vs__fade-leave-active {
pointer-events: none;
transition: opacity var(--vs-transition-duration) var(--vs-transition-timing-function)
}
.vs__fade-enter, .vs__fade-leave-to {
opacity: 0
}
:root {
--vs-disabled-bg: var(--vs-state-disabled-bg);
--vs-disabled-color: var(--vs-state-disabled-color);
--vs-disabled-cursor: var(--vs-state-disabled-cursor)
}
.vs--disabled .vs__clear, .vs--disabled .vs__dropdown-toggle, .vs--disabled .vs__open-indicator, .vs--disabled .vs__search, .vs--disabled .vs__selected {
background-color: var(--vs-disabled-bg);
cursor: var(--vs-disabled-cursor);
}
.v-select[dir=rtl] .vs__actions {
padding: 0 3px 0 6px
}
.v-select[dir=rtl] .vs__clear {
margin-left: 6px;
margin-right: 0
}
.v-select[dir=rtl] .vs__deselect {
margin-left: 0;
margin-right: 2px
}
.v-select[dir=rtl] .vs__dropdown-menu {
text-align: right
}
.vs__dropdown-toggle {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
background: none;
// border: var(--vs-border-width) var(--vs-border-style) var(--vs-border-color);
border-radius: var(--vs-border-radius);
display: flex;
padding: 0 0 2px 0;
white-space: normal;
margin-top: -6px;
margin-left: -12px;
margin-right: -12px;
min-width: 100px;
// border: 1px solid #01bcd4;
color: #495057;
}
.vs__selected-options {
display: flex;
flex-basis: 100%;
flex-grow: 1;
flex-wrap: wrap;
padding: 0 2px;
position: relative
}
.vs__actions {
align-items: center;
display: flex;
padding: var(--vs-actions-padding);
}
.vs--searchable .vs__dropdown-toggle {
cursor: text
}
.vs--unsearchable .vs__dropdown-toggle {
cursor: pointer
}
.vs--open .vs__dropdown-toggle {
border-bottom-color: transparent;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
.vs__open-indicator {
fill: var(--vs-controls-color);
transform: scale(var(--vs-controls-size));
transition: transform var(--vs-transition-duration) var(--vs-transition-timing-function);
transition-timing-function: var(--vs-transition-timing-function);
}
.vs--open .vs__open-indicator {
transform: rotate(180deg) scale(var(--vs-controls-size))
}
.vs--loading .vs__open-indicator {
opacity: 0
}
.vs__clear {
fill: var(--vs-controls-color);
background-color: transparent;
border: 0;
cursor: pointer;
margin-right: 8px;
margin-bottom: 3px;
padding: 0;
transform: scale(var(--vs-controls-size));
}
.vs__dropdown-menu {
background: var(--vs-dropdown-bg);
border: var(--vs-border-width) var(--vs-border-style) var(--vs-border-color);
border-radius: 0 0 var(--vs-border-radius) var(--vs-border-radius);
border-top-style: none;
box-shadow: var(--vs-dropdown-box-shadow);
box-sizing: border-box;
color: var(--vs-dropdown-color);
display: block;
left: 0;
list-style: none;
margin: 0;
max-height: var(--vs-dropdown-max-height);
min-width: var(--vs-dropdown-min-width);
overflow-y: auto;
padding: 5px 0;
position: absolute;
text-align: left;
top: calc(100% - var(--vs-border-width));
width: 100%;
z-index: var(--vs-dropdown-z-index)
}
.vs__no-options {
text-align: center
}
.vs__dropdown-option {
clear: both;
color: var(--vs-dropdown-option-color);
cursor: pointer;
display: block;
line-height: 1.42857143;
padding: var(--vs-dropdown-option-padding);
white-space: nowrap
}
.vs__dropdown-option--highlight {
background: var(--vs-dropdown-option--active-bg);
color: var(--vs-dropdown-option--active-color)
}
.vs__dropdown-option--deselect {
background: var(--vs-dropdown-option--deselect-bg);
color: var(--vs-dropdown-option--deselect-color)
}
.vs__dropdown-option--disabled {
background: var(--vs-state-disabled-bg);
color: var(--vs-state-disabled-color);
cursor: var(--vs-state-disabled-cursor)
}
.vs__selected {
align-items: center;
background-color: var(--vs-selected-bg);
border: var(--vs-selected-border-width) var(--vs-selected-border-style) var(--vs-selected-border-color);
border-radius: var(--vs-border-radius);
color: var(--vs-selected-color);
display: flex;
line-height: var(--vs-line-height);
margin: 2px 2px 0;
padding: 0 .25em;
z-index: 0;
}
.vs__deselect {
fill: var(--vs-controls-color);
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
background: none;
border: 0;
cursor: pointer;
display: inline-flex;
margin-left: 4px;
padding: 0;
text-shadow: var(--vs-controls--deselect-text-shadow)
}
.vs--single .vs__selected {
background-color: transparent;
border-color: transparent
}
.vs--single.vs--loading .vs__selected, .vs--single.vs--open .vs__selected {
opacity: .4;
position: absolute
}
.vs--single.vs--searching .vs__selected {
display: none
}
.vs__search::-webkit-search-cancel-button {
display: none
}
.vs__search::-ms-clear, .vs__search::-webkit-search-decoration, .vs__search::-webkit-search-results-button, .vs__search::-webkit-search-results-decoration {
display: none
}
.vs__search, .vs__search:focus {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
background: none;
border: 1px solid transparent;
border-left: none;
box-shadow: none;
color: var(--vs-search-input-color);
flex-grow: 1;
font-size: var(--vs-font-size);
line-height: var(--vs-line-height);
max-width: 100%;
outline: none;
// padding: 0 7px;
width: 0;
z-index: 1;
}
.vs__search::-moz-placeholder {
color: var(--vs-search-input-placeholder-color)
}
.vs__search:-ms-input-placeholder {
color: var(--vs-search-input-placeholder-color)
}
.vs__search::placeholder {
color: var(--vs-search-input-placeholder-color)
}
.vs--unsearchable .vs__search {
opacity: 1
}
.vs--unsearchable:not(.vs--disabled) .vs__search {
cursor: pointer
}
.vs--single.vs--searching:not(.vs--open):not(.vs--loading) .vs__search {
opacity: .2
}
.vs__spinner {
align-self: center;
-webkit-animation: vSelectSpinner 1.1s linear infinite;
animation: vSelectSpinner 1.1s linear infinite;
border: .9em solid hsla(0, 0%, 39%, .1);
border-left-color: rgba(60, 60, 60, .45);
font-size: 5px;
opacity: 0;
overflow: hidden;
text-indent: -9999em;
transform: translateZ(0) scale(var(--vs-controls--spinner-size, var(--vs-controls-size)));
transition: opacity .1s
}
.vs__spinner, .vs__spinner:after {
border-radius: 50%;
height: 5em;
transform: scale(var(--vs-controls--spinner-size, var(--vs-controls-size)));
width: 5em
}
.vs--loading .vs__spinner {
opacity: 1
}
.v-select:focus-within {
color: #495057;
background-color: #fff;
border-color: #80bdff;
outline: 0;
box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}
.v-select.is-valid:focus-within {
border-color: #28a745;
box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
}
.v-select.is-invalid:focus-within {
border-color: #dc3545;
box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}
.v-select.vs--disabled {
background-color: #e9ecef;
opacity: 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment