Data Select
<zn-data-select> | ZnDataSelect
Short summary of the component’s intended use.
<div class="form-spacing"> <zn-data-select label="Country" provider="country" name="country"></zn-data-select> <zn-data-select label="Currency" provider="currency" name="currency"></zn-data-select> <zn-data-select label="Color" provider="color" name="color"></zn-data-select> </div>
Examples
Icon Position
Icon position can be set to start
or end
. The default is none
.
<div class="form-spacing"> <zn-data-select provider="country" name="country" value="GB" icon-position="start"></zn-data-select> <zn-data-select provider="country" name="country" icon-position="end"></zn-data-select> </div>
Clearable
<div class="form-spacing"> <zn-data-select provider="country" name="country" clearable></zn-data-select> <zn-data-select provider="currency" name="currency" clearable></zn-data-select> <zn-data-select provider="color" name="color" clearable></zn-data-select> </div>
Filtered
If you only want to display a handful of the provider results, you can use the filter
attribute
to filter the results.
<div class="form-spacing"> <zn-data-select provider="country" name="country" filter="gb,us,fr,de"></zn-data-select> <zn-data-select provider="currency" name="currency" filter="gbp,usd,eur"></zn-data-select> <zn-data-select provider="color" name="color" filter="red,green,blue"></zn-data-select> </div>
Importing
If you’re using the autoloader or the traditional loader, you can ignore this section. Otherwise, feel free to use any of the following snippets to cherry pick this component.
To import this component from the CDN using a script tag:
<script type="module" src="https://cdn.jsdelivr.net/npm/@kubex/zinc@1.0.0/dist/components/data-select/data-select.js"></script>
To import this component from the CDN using a JavaScript import:
import 'https://cdn.jsdelivr.net/npm/@kubex/zinc@1.0.0/dist/components/data-select/data-select.js';
To import this component using a bundler:
import '@kubex/zinc/dist/components/data-select/data-select.js';
Slots
Name | Description |
---|---|
(default) | The default slot. |
example
|
An example slot. |
Learn more about using slots.
Properties
Name | Description | Reflects | Type | Default |
---|---|---|---|---|
name
|
The name of the select. Used for form submission. |
string
|
- | |
value
|
The value of the select. Used for form submission. |
string
|
- | |
provider
|
The provider of the select. |
'color' | 'currency' | 'country'
|
- | |
filter
|
An array of keys to use for filtering the options in the selected provider. |
string[]
|
- | |
size
|
The selects size. |
|
'small' | 'medium' | 'large'
|
'medium'
|
clearable
|
Should we show the clear button |
boolean
|
- | |
label
|
The selects label. If you need to display HTML, use the label slot instead. |
string
|
''
|
|
labelTooltip
label-tooltip
|
Text that appears in a tooltip next to the label. If you need to display HTML in the tooltip, use
the label-tooltip slot instead.
|
string
|
''
|
|
contextNote
context-note
|
Text that appears above the input, on the right, to add additional context. If you need to display
HTML in this text, use the context-note slot instead.
|
string
|
''
|
|
placement
|
The preferred placement of the selects menu. Note that the actual placement may vary as needed to keep the listbox inside the viewport. |
|
'top' | 'bottom'
|
'bottom'
|
helpText
help-text
|
The selects help text. If you need to display HTML, use the help-text slot instead.
|
string
|
''
|
|
required
|
The selects required attribute. |
|
boolean
|
false
|
updateComplete |
A read-only promise that resolves when the component has finished updating. |
Learn more about attributes and properties.
Events
Name | React Event | Description | Event Detail |
---|---|---|---|
zn-event-name |
|
Emitted as an example. | - |
Learn more about events.
Custom Properties
Name | Description | Default |
---|---|---|
--example |
An example CSS custom property. |
Learn more about customizing CSS custom properties.
Parts
Name | Description |
---|---|
base |
The component’s base wrapper. |
Learn more about customizing CSS parts.
Dependencies
This component automatically imports the following dependencies.
<zn-example>