Created
March 21, 2021 21:30
-
-
Save jnarowski/9e9bdf713ed8e7a5e682b114f805367c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div> | |
<multiselect v-model="value" :options="options" /> | |
</div> | |
</template> | |
<script> | |
import Multiselect from '@vueform/multiselect/dist/multiselect.vue2' | |
export default { | |
components: { | |
Multiselect, | |
}, | |
data() { | |
return { | |
value: null, | |
options: ['Batman', 'Robin', 'Joker'], | |
} | |
}, | |
} | |
</script> | |
<style> | |
.multiselect { | |
position: relative; | |
margin: 0 auto; | |
font-size: 0; | |
} | |
.multiselect > * { | |
font-size: initial; | |
} | |
.multiselect.is-searchable { | |
cursor: auto; | |
} | |
.multiselect-input { | |
width: 100%; | |
display: flex; | |
align-items: center; | |
min-height: 40px; | |
border: 1px solid #e7e7e7; | |
border-radius: 3px; | |
box-sizing: border-box; | |
cursor: pointer; | |
position: relative; | |
outline: none; | |
} | |
.multiselect-input:before { | |
position: absolute; | |
right: 12px; | |
top: 50%; | |
color: #999; | |
border-style: solid; | |
border-width: 5px 5px 0; | |
border-color: #999 transparent transparent; | |
content: ''; | |
transform: translateY(-50%); | |
transition: 0.3s transform; | |
} | |
.is-disabled .multiselect-input { | |
background: #f9f9f9; | |
} | |
.is-open .multiselect-input { | |
border-radius: 3px 3px 0 0; | |
} | |
.is-open .multiselect-input:before { | |
transform: translateY(-50%) rotate(180deg); | |
} | |
.no-caret .multiselect-input:before { | |
display: none; | |
} | |
.multiselect-placeholder, | |
.multiselect-single-label, | |
.multiselect-multiple-label { | |
display: flex; | |
align-items: center; | |
height: 100%; | |
padding-left: 14px; | |
position: absolute; | |
left: 0; | |
top: 0; | |
pointer-events: none; | |
background: transparent; | |
} | |
.multiselect-placeholder { | |
color: #777777; | |
} | |
.is-single .multiselect-search, | |
.is-multiple .multiselect-search { | |
display: flex; | |
height: 100%; | |
width: 100%; | |
background: transparent; | |
} | |
.is-single .multiselect-search input, | |
.is-multiple .multiselect-search input { | |
width: 100%; | |
border: 0; | |
padding: 8px 35px 8px 14px; | |
outline: none; | |
background: transparent; | |
font-size: 16px; | |
font-family: inherit; | |
} | |
.is-single.no-caret .multiselect-search input, | |
.is-multiple.no-caret .multiselect-search input { | |
padding: 8px 14px 8px 14px; | |
} | |
.is-tags .multiselect-search { | |
flex-grow: 1; | |
} | |
.is-tags .multiselect-search input { | |
outline: none; | |
border: 0; | |
margin: 0 0 5px 3px; | |
flex-grow: 1; | |
min-width: 100%; | |
font-size: 16px; | |
font-family: inherit; | |
} | |
.multiselect-clear { | |
position: absolute; | |
right: 0; | |
top: 1px; | |
width: 36px; | |
height: 36px; | |
background: #fff; | |
&:before, | |
&:after { | |
position: absolute; | |
top: 12px; | |
left: 16px; | |
content: ' '; | |
height: 12px; | |
width: 2px; | |
background-color: #999; | |
} | |
&:before { | |
transform: rotate(45deg); | |
} | |
&:after { | |
transform: rotate(-45deg); | |
} | |
&:hover { | |
&:before, | |
&:after { | |
background-color: #555; | |
} | |
} | |
} | |
.multiselect-tags { | |
display: flex; | |
height: 100%; | |
width: 100%; | |
align-items: center; | |
justify-content: flex-start; | |
padding-left: 9px; | |
margin-top: 5px; | |
flex-wrap: wrap; | |
padding-right: 36px; | |
} | |
.no-caret .multiselect-tags { | |
padding-right: 9px; | |
} | |
.multiselect-tag { | |
background: #41b883; | |
color: #fff; | |
font-size: 14px; | |
font-weight: 600; | |
padding: 0 0 0 8px; | |
border-radius: 3px; | |
margin-right: 5px; | |
margin-bottom: 5px; | |
display: flex; | |
align-items: center; | |
cursor: text; | |
white-space: nowrap; | |
} | |
.multiselect-tag i { | |
cursor: pointer; | |
} | |
.multiselect-tag i:before { | |
content: '\D7'; | |
color: #266d4d; | |
font-size: 14px; | |
font-weight: 700; | |
padding: 1px 5px 1px 5px; | |
margin-left: 3px; | |
display: flex; | |
font-style: normal; | |
} | |
.multiselect-tag i:hover:before { | |
color: #ffffff; | |
background: rgba(255, 255, 255, 0.2); | |
} | |
.is-disabled .multiselect-tag { | |
background: #a0a0a0; | |
padding: 1px 8px 1px 8px; | |
} | |
.multiselect-fake-input { | |
background: transparent; | |
width: 100%; | |
height: 1px; | |
border: 0; | |
padding: 0; | |
font-size: 0; | |
margin-top: -1px; | |
outline: none; | |
&:active, | |
&:focus { | |
outline: none; | |
} | |
} | |
.multiselect-options { | |
position: absolute; | |
left: 0; | |
right: 0px; | |
border: 1px solid #e8e8e8; | |
margin-top: -1px; | |
max-height: 160px; | |
overflow-y: scroll; | |
-webkit-overflow-scrolling: touch; | |
z-index: 100; | |
background: #ffffff; | |
} | |
.multiselect-option { | |
display: flex; | |
min-height: 40px; | |
padding: 9px 12px; | |
box-sizing: border-box; | |
color: #222; | |
text-decoration: none; | |
align-items: center; | |
justify-content: flex-start; | |
text-align: left; | |
} | |
.multiselect-option.is-pointed { | |
background: #e6e6e6; | |
} | |
.multiselect-option.is-disabled { | |
background: #f9f9f9; | |
color: #a6a6a6; | |
cursor: not-allowed; | |
} | |
.multiselect-option.is-selected { | |
background: #41b883; | |
color: #ffffff; | |
} | |
.multiselect-option.is-selected.is-pointed { | |
background: #4fbd8c; | |
} | |
.is-multiple .multiselect-option.is-selected, | |
.is-tags .multiselect-option.is-selected { | |
color: #999999; | |
background: transparent; | |
} | |
.is-multiple .multiselect-option.is-selected.is-pointed, | |
.is-tags .multiselect-option.is-selected.is-pointed { | |
background: #f1f1f1; | |
} | |
.multiselect-no-options, | |
.multiselect-no-results { | |
display: flex; | |
padding: 10px 12px; | |
color: #777; | |
} | |
.multiselect-spinner { | |
position: absolute; | |
right: 12px; | |
top: 0; | |
width: 16px; | |
height: 16px; | |
background: #fff; | |
display: block; | |
transform: translateY(50%); | |
} | |
.multiselect-spinner:before, | |
.multiselect-spinner:after { | |
position: absolute; | |
content: ''; | |
top: 50%; | |
left: 50%; | |
margin: -8px 0 0 -8px; | |
width: 16px; | |
height: 16px; | |
border-radius: 100%; | |
border-color: #41b883 transparent transparent; | |
border-style: solid; | |
border-width: 2px; | |
box-shadow: 0 0 0 1px transparent; | |
} | |
.is-disabled .multiselect-spinner { | |
background: #f9f9f9; | |
} | |
.is-disabled .multiselect-spinner:before, | |
.is-disabled .multiselect-spinner:after { | |
border-color: #999999 transparent transparent; | |
} | |
.multiselect-spinner:before { | |
animation: spinning 2.4s cubic-bezier(0.41, 0.26, 0.2, 0.62); | |
animation-iteration-count: infinite; | |
} | |
.multiselect-spinner:after { | |
animation: spinning 2.4s cubic-bezier(0.51, 0.09, 0.21, 0.8); | |
animation-iteration-count: infinite; | |
} | |
.multiselect-enter-active { | |
transition: all 0.15s ease; | |
} | |
.multiselect-leave-active { | |
transition: all 0s; | |
} | |
.multiselect-enter, | |
.multiselect-leave-active { | |
opacity: 0; | |
} | |
.multiselect-loading-enter-active, | |
.multiselect-loading-leave-active { | |
transition: opacity 0.4s ease-in-out; | |
opacity: 1; | |
} | |
.multiselect-loading-enter, | |
.multiselect-loading-leave-active { | |
opacity: 0; | |
} | |
@keyframes spinning { | |
from { | |
transform: rotate(0); | |
} | |
to { | |
transform: rotate(2turn); | |
} | |
} | |
.multiselect-tag.is-user { | |
padding: 5px 8px; | |
border-radius: 22px; | |
background: #35495e; | |
margin: 3px 3px 8px; | |
} | |
.multiselect-tag.is-user img { | |
width: 18px; | |
border-radius: 50%; | |
height: 18px; | |
margin-right: 8px; | |
border: 2px solid #ffffffbf; | |
} | |
.multiselect-tag.is-user i:before { | |
color: #ffffff; | |
border-radius: 50%; | |
} | |
.user-image { | |
margin: 0 6px 0 0; | |
border-radius: 50%; | |
height: 22px; | |
} | |
.character-option-icon { | |
margin: 0 6px 0 0; | |
height: 22px; | |
} | |
.character-label-icon { | |
margin: 0 6px 0 0; | |
height: 26px; | |
} | |
</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment