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
The following CSS variables can be used to customize multiselect when using `default.css`:
164
+
165
+
```css
166
+
--ms-font-size: 1rem
167
+
--ms-line-height: 1.375
168
+
--ms-bg: #FFFFFF
169
+
--ms-bg-disabled: #F3F4F6
170
+
--ms-border-color: #D1D5DB
171
+
--ms-border-width: 1px
172
+
--ms-radius: 4px
173
+
--ms-py: 0.5rem
174
+
--ms-px: 0.875rem
175
+
--ms-ring-width: 3px
176
+
--ms-ring-color: #10B98130
177
+
--ms-placeholder-color: #9CA3AF
178
+
179
+
--ms-tag-font-size: 0.875rem
180
+
--ms-tag-line-height: 1.25rem
181
+
--ms-tag-font-weight: 600
182
+
--ms-tag-bg: #10B981
183
+
--ms-tag-bg-disabled: #9CA3AF
184
+
--ms-tag-color: #FFFFFF
185
+
--ms-tag-color-disabled: #FFFFFF
186
+
--ms-tag-radius: 4px
187
+
--ms-tag-py: 0.125rem
188
+
--ms-tag-px: 0.5rem
189
+
--ms-tag-my: 0.25rem
190
+
--ms-tag-mx: 0.25rem
191
+
192
+
--ms-tag-remove-radius: 4px
193
+
--ms-tag-remove-py: 0.25rem
194
+
--ms-tag-remove-px: 0.25rem
195
+
--ms-tag-remove-my: 0rem
196
+
--ms-tag-remove-mx: 0.125rem
197
+
198
+
--ms-dropdown-bg: #FFFFFF
199
+
--ms-dropdown-border-color: #D1D5DB
200
+
--ms-dropdown-border-width: 1px
201
+
--ms-dropdown-radius: 4px
202
+
203
+
--ms-option-font-size: 1rem
204
+
--ms-option-line-height: 1.375
205
+
--ms-option-bg-pointed: #FFFFFF
206
+
--ms-option-bg-selected: #10B981
207
+
--ms-option-bg-disabled: #FFFFFF
208
+
--ms-option-bg-selected-pointed: #26C08E
209
+
--ms-option-bg-selected-disabled: #FFFFFF
210
+
--ms-option-color-pointed: #1F2937
211
+
--ms-option-color-selected: #FFFFFF
212
+
--ms-option-color-disabled: #D1D5DB
213
+
--ms-option-color-selected-pointed: #FFFFFF
214
+
--ms-option-color-selected-disabled: #D1FAE5
215
+
--ms-option-py: 0.5rem
216
+
--ms-option-px: 0.75rem
217
+
218
+
--ms-empty-color: #4B5563
219
+
```
220
+
221
+
Override them globally:
222
+
223
+
``` css
224
+
:root {
225
+
--ms-tag-bg: #059669;
226
+
--ms-tag-color: #D1FAE5;
227
+
--ms-tag-radius: 9999px;
228
+
--ms-tag-font-weight: 400;
229
+
}
230
+
```
231
+
232
+
Or on an instance level:
233
+
234
+
```vue
235
+
<Multiselect
236
+
v-model="value"
237
+
:options="options"
238
+
class="multiselect-green"
239
+
/>
240
+
241
+
<Multiselect
242
+
v-model="value"
243
+
:options="options"
244
+
class="multiselect-blue"
245
+
/>
246
+
```
247
+
248
+
```css
249
+
.multiselect-green {
250
+
--ms-tag-bg: #D1FAE5;
251
+
--ms-tag-color: #059669;
252
+
}
253
+
254
+
.multiselect-blue {
255
+
--ms-tag-bg: #DBEAFE;
256
+
--ms-tag-color: #2563EB;
257
+
}
258
+
```
259
+
260
+
## Styling with Tailwind CSS
261
+
262
+
The `Multiselect` component accepts a `classes` property which allows to override default class names. When using utility classes you don't need to import `default.css`. Here's a default styling for Tailwind CSS:
Certain classes has different states which are merged to the base class when the state is active. For exmple `dropdown` will be merged with `dropdownTop` when `open-direction: 'top'` resulting in the following classes:
The same is true for `container`, `tag`, `options` and `option` classes.
307
+
308
+
In case you need to override the same type of utility you might use [@neojp/tailwind-important-variant](https://www.npmjs.com/package/@neojp/tailwindcss-important-variant) and use eg. `bg-green-500!`.
309
+
160
310
## Support
161
311
162
312
Join our [Discord channel](https://discord.gg/WhX2nG6GTQ) or [open an issue](https://github.com/vueform/multiselect/issues).
@@ -180,10 +330,11 @@ Join our [Discord channel](https://discord.gg/WhX2nG6GTQ) or [open an issue](htt
180
330
|**loading**|`boolean`|`false`| Whether a loading spinner should be shown. |
181
331
|**id**|`string`|`'multiselect'`| The `id` of the multiselect container DOM. |
182
332
|**caret**|`boolean`|`true`| Whether should display the caret symbol on the right. |
183
-
|**maxHeight**|`number`|`160`| The maximum height of options list (px). |
333
+
|**maxHeight**|`string`|`10rem`| The maximum height of options list. |
184
334
|**noOptionsText**|`string`|`'The list is empty'`| The text that should be displayed when options list is empty. |
185
335
|**noResultsText**|`string`|`'No results found'`| The text that should be displayed when there are no search results. |
186
336
|**openDirection**|`string`|`bottom`| Whether the option list should be displayed above or below the multiselect. Possible values: `top\|bottom`|
337
+
| **classes** | `object` | | An object of class names that gets merged with the default values. Default: `{`<br> `container: 'multiselect',`<br> `containerDisabled: 'is-disabled',`<br> `containerOpen: 'is-open',`<br> `containerOpenTop: 'is-open-top',`<br> `containerActive: 'is-active',`<br> `singleLabel: 'multiselect-single-label',`<br> `multipleLabel: 'multiselect-multiple-label',`<br> `search: 'multiselect-search',`<br> `tags: 'multiselect-tags',`<br> `tag: 'multiselect-tag',`<br> `tagDisabled: 'is-disabled',`<br> `tagRemove: 'multiselect-tag-remove',`<br> `tagRemoveIcon: 'multiselect-tag-remove-icon',`<br> `tagsSearch: 'multiselect-tags-search',`<br> `placeholder: 'multiselect-placeholder',`<br> `caret: 'multiselect-caret',`<br> `caretOpen: 'is-open',`<br> `clear: 'multiselect-clear',`<br> `clearIcon: 'multiselect-clear-icon',`<br> `spinner: 'multiselect-spinner',`<br> `dropdown: 'multiselect-dropdown',`<br> `dropdownTop: 'is-top',`<br> `options: 'multiselect-options',`<br> `optionsTop: 'is-top',`<br> `option: 'multiselect-option',`<br> `optionPointed: 'is-pointed',`<br> `optionSelected: 'is-selected',`<br> `optionDisabled: 'is-disabled',`<br> `optionSelectedPointed: 'is-selected is-pointed',`<br> `optionSelectedDisabled: 'is-selected is-disabled',`<br> `noOptions: 'multiselect-no-options',`<br> `noResults: 'multiselect-no-results',`<br> `fakeInput: 'multiselect-fake-input',`<br> `spacer: 'multiselect-spacer'`<br>`}` |
187
338
188
339
### Advanced Props
189
340
@@ -199,7 +350,7 @@ Join our [Discord channel](https://discord.gg/WhX2nG6GTQ) or [open an issue](htt
199
350
|**resolveOnLoad**|`boolean`|`true`| Whether async options should be loaded initially (with an empty query). This should be `true` if you are planning to load non-object value(s) initially while using async options (to fetch matching objects for values). |
200
351
|**appendNewTag**|`boolean`|`true`| Whether it should append new tag automatically to option list when using `tags` mode with `createTag`. If set to `false` you need to take care of appending a new tag to the provided `:options` list upon `@tag` event. |
201
352
|**createTag**|`boolean`|`false`| Whether it should allow creating new tag based on search query when using `tags` mode. |
202
-
|**addTagOn**|`array`|`['enter']`| The list of keys that creates a new tag while typing in the search field when having `createTag` enabled. Possible values: `enter\|space`. |
353
+
|**addTagOn**|`array`|`['enter']`| The list of keys that creates a new tag while typing in the search field when having `createTag` enabled. Possible values: `enter\|space\|;\|,`. |
203
354
|**hideSelected**|`boolean`|`true`| Whether selected options should be excluded from the option list when using `multiple` or `tags` mode. |
204
355
|**showOptions**|`boolean`|`true`| Whether option list should be displayed. Can be used to create free-typed tags. |
205
356
|**object**|`boolean`|`false`| Whether the value should be stored as an object.<br>If **false**:<br>`value: ['js','jsx','ts']`<br>If **true**:<br> `value: [`<br> `{value:'js',label:'Javascript'},`<br> `{value:'jsx',label:'JSX'},`<br> `{value:'ts',label:'Typescript'}`<br>`]`|
0 commit comments