You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Then you need to import `themes/tailwind.css` to you main component:
568
569
569
-
```vue
570
+
```vue
570
571
<template>
571
572
<div id="app">
572
573
<Multiselect ... />
@@ -586,7 +587,7 @@ Then you need to import `themes/tailwind.css` to you main component:
586
587
587
588
Alternatively you can define class names directly by passing them to the `Multiselect` component via `classes` property. When using this approach you don't need to import `tailwind.css`. Here's a default styling for Tailwind CSS (the same included in `tailwind.css`):
@@ -666,18 +667,18 @@ In case you need to override the same type of utility you might use [@neojp/tail
666
667
667
668
### Single select
668
669
669
-
```vue
670
+
```vue
670
671
<Multiselect
671
672
v-model="value"
672
673
:options="['Batman', 'Robin', 'Joker']"
673
674
/>
674
675
```
675
676
676
-
<ahref="https://jsfiddle.net/t421d7cg/"target="_blank">JSFiddle - Example #1</a>
677
+
<ahref="https://jsfiddle.net/xajub20o/"target="_blank">JSFiddle - Example #1</a>
677
678
678
679
### Multiselect with object options
679
680
680
-
```vue
681
+
```vue
681
682
<Multiselect
682
683
v-model="value"
683
684
mode="multiple"
@@ -690,11 +691,11 @@ In case you need to override the same type of utility you might use [@neojp/tail
690
691
/>
691
692
```
692
693
693
-
<ahref="https://jsfiddle.net/t421d7cg/"target="_blank">JSFiddle - Example #2</a>
694
+
<ahref="https://jsfiddle.net/xajub20o/"target="_blank">JSFiddle - Example #2</a>
694
695
695
696
### Multiselect with disabled options
696
697
697
-
```vue
698
+
```vue
698
699
<Multiselect
699
700
v-model="value"
700
701
mode="multiple"
@@ -707,11 +708,11 @@ In case you need to override the same type of utility you might use [@neojp/tail
707
708
/>
708
709
```
709
710
710
-
<ahref="https://jsfiddle.net/t421d7cg/"target="_blank">JSFiddle - Example #3</a>
711
+
<ahref="https://jsfiddle.net/xajub20o/"target="_blank">JSFiddle - Example #3</a>
711
712
712
713
### Multiselect with groups
713
714
714
-
```vue
715
+
```vue
715
716
<Multiselect
716
717
v-model="value"
717
718
mode="multiple"
@@ -730,11 +731,11 @@ In case you need to override the same type of utility you might use [@neojp/tail
730
731
/>
731
732
```
732
733
733
-
<ahref="https://jsfiddle.net/t421d7cg/"target="_blank">JSFiddle - Example #4</a>
734
+
<ahref="https://jsfiddle.net/xajub20o/"target="_blank">JSFiddle - Example #4</a>
734
735
735
736
### Tags with search, create and array of objects options
736
737
737
-
```vue
738
+
```vue
738
739
<Multiselect
739
740
v-model="value"
740
741
mode="tags"
@@ -749,11 +750,11 @@ In case you need to override the same type of utility you might use [@neojp/tail
749
750
/>
750
751
```
751
752
752
-
<ahref="https://jsfiddle.net/t421d7cg/"target="_blank">JSFiddle - Example #5</a>
753
+
<ahref="https://jsfiddle.net/xajub20o/"target="_blank">JSFiddle - Example #5</a>
753
754
754
755
### Autocomplete with async options
755
756
756
-
```vue
757
+
```vue
757
758
<Multiselect
758
759
v-model="value"
759
760
placeholder="Choose a programming language"
@@ -768,11 +769,11 @@ In case you need to override the same type of utility you might use [@neojp/tail
768
769
/>
769
770
```
770
771
771
-
<ahref="https://jsfiddle.net/t421d7cg/"target="_blank">JSFiddle - Example #6</a>
772
+
<ahref="https://jsfiddle.net/xajub20o/"target="_blank">JSFiddle - Example #6</a>
772
773
773
774
### Tags with async options
774
775
775
-
```vue
776
+
```vue
776
777
<Multiselect
777
778
v-model="value"
778
779
mode="tags"
@@ -789,11 +790,11 @@ In case you need to override the same type of utility you might use [@neojp/tail
789
790
/>
790
791
```
791
792
792
-
<ahref="https://jsfiddle.net/t421d7cg/"target="_blank">JSFiddle - Example #7</a>
793
+
<ahref="https://jsfiddle.net/xajub20o/"target="_blank">JSFiddle - Example #7</a>
793
794
794
795
### Select with custom options slot
795
796
796
-
```vue
797
+
```vue
797
798
<Multiselect
798
799
v-model="value"
799
800
placeholder="Select your character"
@@ -817,11 +818,11 @@ In case you need to override the same type of utility you might use [@neojp/tail
817
818
818
819
```
819
820
820
-
<ahref="https://jsfiddle.net/t421d7cg/"target="_blank">JSFiddle - Example #8</a>
821
+
<ahref="https://jsfiddle.net/xajub20o/"target="_blank">JSFiddle - Example #8</a>
821
822
822
823
### Multiselect with custom label slot
823
824
824
-
```vue
825
+
```vue
825
826
<Multiselect
826
827
v-model="value"
827
828
mode="multiple"
@@ -842,11 +843,11 @@ In case you need to override the same type of utility you might use [@neojp/tail
842
843
843
844
```
844
845
845
-
<ahref="https://jsfiddle.net/t421d7cg/"target="_blank">JSFiddle - Example #9</a>
846
+
<ahref="https://jsfiddle.net/xajub20o/"target="_blank">JSFiddle - Example #9</a>
846
847
847
848
### Tags with custom tags slot
848
849
849
-
```vue
850
+
```vue
850
851
<template>
851
852
<Multiselect
852
853
v-model="value"
@@ -913,14 +914,14 @@ In case you need to override the same type of utility you might use [@neojp/tail
913
914
</style>
914
915
```
915
916
916
-
<ahref="https://jsfiddle.net/t421d7cg/"target="_blank">JSFiddle - Example #10</a>
917
+
<ahref="https://jsfiddle.net/xajub20o/"target="_blank">JSFiddle - Example #10</a>
917
918
918
919
919
920
### Async options with default values
920
921
921
922
When using `resolveOnLoad: false` we can add default values with `object: true` and providing options as objects, containing both `label` and `value` props. This is because option list is not resolved when the component is mounted so Multiselect has no idea of what option labels should be if only plain values were provided.
922
923
923
-
```vue
924
+
```vue
924
925
<template>
925
926
<Multiselect
926
927
mode="tags"
@@ -949,14 +950,14 @@ export default {
949
950
</script>
950
951
```
951
952
952
-
<ahref="https://jsfiddle.net/t421d7cg/"target="_blank">JSFiddle - Example #11</a>
953
+
<ahref="https://jsfiddle.net/xajub20o/"target="_blank">JSFiddle - Example #11</a>
953
954
954
955
955
956
### Default values that are not among the options using `object: true`
956
957
957
958
If we want to add default values without having to add them to options list we can use `object: true` and provide them as objects, containing both `label` and `value` props. This is because if a plain value is not among Multiselect options it has no idea of what option label should be.
958
959
959
-
```vue
960
+
```vue
960
961
<template>
961
962
<Multiselect
962
963
mode="tags"
@@ -985,14 +986,14 @@ export default {
985
986
</script>
986
987
```
987
988
988
-
<ahref="https://jsfiddle.net/t421d7cg/"target="_blank">JSFiddle - Example #12</a>
989
+
<ahref="https://jsfiddle.net/xajub20o/"target="_blank">JSFiddle - Example #12</a>
989
990
990
991
991
992
### Default values that are not among the options using `allowAbsent: true`
992
993
993
994
If our async option list returns an **array of strings** we can use `allowAbsent: true` to allow value(s) which are not among the option list. The reason why this only works with an array of strings option list is because plain values like `Java` and `JavaScript` will use the same string for label and value.
994
995
995
-
```vue
996
+
```vue
996
997
<template>
997
998
<Multiselect
998
999
mode="tags"
@@ -1021,14 +1022,14 @@ export default {
1021
1022
</script>
1022
1023
```
1023
1024
1024
-
<ahref="https://jsfiddle.net/t421d7cg/"target="_blank">JSFiddle - Example #13</a>
1025
+
<ahref="https://jsfiddle.net/xajub20o/"target="_blank">JSFiddle - Example #13</a>
1025
1026
1026
1027
1027
1028
### Manage created tag asynchronously
1028
1029
1029
1030
Search is restricted by `regex` and tag creation is controlled by `onCreate(option, select$)`.
1030
1031
1031
-
```vue
1032
+
```vue
1032
1033
<template>
1033
1034
<Multiselect
1034
1035
mode="tags"
@@ -1070,14 +1071,13 @@ export default {
1070
1071
</script>
1071
1072
```
1072
1073
1073
-
<ahref="https://jsfiddle.net/t421d7cg/"target="_blank">JSFiddle - Example #14</a>
1074
-
1074
+
<ahref="https://jsfiddle.net/xajub20o/"target="_blank">JSFiddle - Example #14</a>
1075
1075
1076
1076
### Load async options from API on open with infinite scroll
1077
1077
1078
1078
Options are not loaded initially, only when the users clicks the dropdown the first time. It also virtualizes the option list with `infinite: true` even large list of options can be loaded.
1079
1079
1080
-
```vue
1080
+
```vue
1081
1081
<Multiselect
1082
1082
v-model="value"
1083
1083
mode="tags"
@@ -1102,7 +1102,36 @@ Options are not loaded initially, only when the users clicks the dropdown the fi
1102
1102
/>
1103
1103
```
1104
1104
1105
-
<ahref="https://jsfiddle.net/t421d7cg/"target="_blank">JSFiddle - Example #15</a>
1105
+
<ahref="https://jsfiddle.net/xajub20o/"target="_blank">JSFiddle - Example #15</a>
1106
+
1107
+
### Multiselect with localized texts
1108
+
1109
+
Options are not loaded initially, only when the users clicks the dropdown the first time. It also virtualizes the option list with `infinite: true` even large list of options can be loaded.
1110
+
1111
+
```vue
1112
+
<template>
1113
+
<Multiselect
1114
+
v-model="value"
1115
+
locale="de"
1116
+
fallback-locale="en"
1117
+
:options="[
1118
+
{ value: 1, label: { en: 'One', de: 'Eins' } },
1119
+
{ value: 2, label: { en: 'Two' } },
1120
+
{ value: 3, label: { es: 'Tres'} },
1121
+
{ value: 4, label: 'Four' },
1122
+
]"
1123
+
/>
1124
+
</template>
1125
+
<script>
1126
+
export default {
1127
+
data: () => ({
1128
+
value: [1]
1129
+
})
1130
+
}
1131
+
</script>
1132
+
```
1133
+
1134
+
<ahref="https://jsfiddle.net/xajub20o/"target="_blank">JSFiddle - Example #16</a>
0 commit comments