{"slug":"select","name":"Select","category":"Form & Input","summary":"A custom listbox with search, multiple selection, and clearing.","status":"stable","since":"0.1.0","import":"import { Select } from '@elluzion/iv-ui';","usage":["`options` accepts strings or `{ value, label, disabled }`.","`multiple` turns `value` into an array; `searchable` adds a filter field.","Bind `value`; `onchange` fires with the committed selection."],"props":[{"name":"options","type":"SelectOption[]","default":"[]","description":"Options to render. Strings are used as both value and label.","required":true,"bindable":false},{"name":"value","type":"string | string[]","default":"''","description":"Selected value(s). Bind with `bind:value`.","required":false,"bindable":true},{"name":"multiple","type":"boolean","default":"false","description":"Allows several values; `value` becomes an array.","required":false,"bindable":false},{"name":"searchable","type":"boolean","default":"false","description":"Adds a filter field to the option list.","required":false,"bindable":false},{"name":"clearable","type":"boolean","default":"false","description":"Shows a reset button while a value is selected.","required":false,"bindable":false},{"name":"disabled","type":"boolean","default":"false","description":"Disables interaction and applies the disabled treatment.","required":false,"bindable":false},{"name":"required","type":"boolean","default":"false","description":"Marks the field as required.","required":false,"bindable":false},{"name":"placeholder","type":"string","default":"'Select…'","description":"Text shown while nothing is selected.","required":false,"bindable":false},{"name":"label","type":"string","default":"''","description":"Visible label for the control.","required":false,"bindable":false},{"name":"error","type":"string","default":"''","description":"Error message. Switches the control to the error treatment.","required":false,"bindable":false},{"name":"helper","type":"string","default":"''","description":"Helper text shown below the control.","required":false,"bindable":false},{"name":"name","type":"string","default":"''","description":"Form field name submitted with the surrounding form.","required":false,"bindable":false},{"name":"size","type":"'sm' | 'md' | 'lg'","default":"'md'","description":"Control size.","required":false,"bindable":false}],"events":[{"name":"change","type":"(e: CustomEvent<{ value: string | string[] }>) => void","default":null,"description":"Called with `{ value }` after the selection changes.","required":false,"bindable":false},{"name":"focus","type":"(e: FocusEvent) => void","default":null,"description":"Called when the trigger receives focus.","required":false,"bindable":false},{"name":"blur","type":"(e: FocusEvent) => void","default":null,"description":"Called when the trigger loses focus.","required":false,"bindable":false},{"name":"keydown","type":"(e: KeyboardEvent) => void","default":null,"description":"Called on keydown inside the trigger.","required":false,"bindable":false}],"snippets":[],"types":[{"name":"SelectOption","kind":"type","code":"type SelectOption = string | { value: string; label?: string; disabled?: boolean };","description":"An option value or a full option object."}],"manual":[],"tokens":["--iv_border","--iv_border-error","--iv_border-focus","--iv_border-hover","--iv_control-md","--iv_control-pad-x","--iv_control-pad-x-lg","--iv_control-pad-x-sm","--iv_control-pad-y","--iv_control-pad-y-lg","--iv_control-pad-y-sm","--iv_cursor","--iv_disabled-opacity","--iv_ease-in-out","--iv_ease-out","--iv_error","--iv_error-surface","--iv_font-mono","--iv_font-ui","--iv_foreground","--iv_foreground-dim","--iv_leading-loose","--iv_outline-offset","--iv_outline-width","--iv_radius-sm","--iv_ring","--iv_ring-width","--iv_scrollbar-size","--iv_select-dropdown-max-h","--iv_shadow-md","--iv_spacing-2xs","--iv_spacing-sm","--iv_spacing-xs","--iv_surface-overlay","--iv_surface-raised","--iv_text-base","--iv_text-body-sm","--iv_text-chips","--iv_text-label","--iv_text-lg","--iv_text-sm","--iv_transition-base","--iv_transition-fast"],"cssHooks":["iv-chevron","iv-chip","iv-chip-placeholder","iv-chips","iv-clear-btn","iv-disabled","iv-dropdown","iv-error-message","iv-has-error","iv-helper-message","iv-label","iv-lg","iv-message","iv-open","iv-placeholder","iv-required-mark","iv-root","iv-search","iv-search-icon","iv-select-options","iv-sm","iv-trigger","iv-trigger-label"],"accessibility":{"keyboard":[["Enter / Space / ArrowDown","Opens the list."],["Arrow keys","Move the active option."],["Enter","Selects the active option."],["Escape","Closes the list."]],"notes":["The trigger is a `combobox` with `aria-expanded`, `aria-controls`, and `aria-activedescendant`.","Options use the `option` role inside a `listbox`.","Error text is linked through `aria-describedby`; the trigger gets `aria-invalid`."]},"related":[{"title":"NativeSelect","summary":"A native select element with the library field treatment.","url":"/components/native-select","kind":"Component"},{"title":"Menu","summary":"A vertical list of commands, options, or links.","url":"/components/menu","kind":"Component"},{"title":"Input","summary":"A single-line text field with an optional label, helper, and error state.","url":"/components/input","kind":"Component"},{"title":"Field","summary":"Labels a custom control and renders its helper or error message.","url":"/components/field","kind":"Component"}],"examples":[{"id":"basic","title":"Basic","description":"A labelled single select with a placeholder.","code":"<script lang=\"ts\">\n\timport { Select } from '@elluzion/iv-ui';\n\n\tlet branch = $state('');\n</script>\n\n<div class=\"field-row\">\n\t<Select\n\t\tlabel=\"Branch\"\n\t\tplaceholder=\"Choose a branch\"\n\t\toptions={['main', 'release', 'feat/docs-site']}\n\t\tbind:value={branch}\n\t\thelper=\"Deploys use the selected branch.\"\n\t/>\n</div>\n\n<style>\n\t.field-row {\n\t\twidth: 100%;\n\t\tmax-width: 320px;\n\t}\n</style>"},{"id":"multiple","title":"Multiple","description":"Selected values render as chips and `value` is an array.","code":"<script lang=\"ts\">\n\timport { Select } from '@elluzion/iv-ui';\n\n\tlet services = $state<string[]>(['logs', 'metrics']);\n</script>\n\n<div class=\"field-row\">\n\t<Select\n\t\tlabel=\"Services\"\n\t\tmultiple\n\t\toptions={['logs', 'metrics', 'traces', 'alerts', 'backups']}\n\t\tbind:value={services}\n\t\thelper=\"Selected services receive the retention policy.\"\n\t/>\n\t<p class=\"readout\">selected: {services.join(', ') || '—'}</p>\n</div>\n\n<style>\n\t.field-row {\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\tgap: var(--iv_spacing-md);\n\t\twidth: 100%;\n\t\tmax-width: 360px;\n\t}\n\n\t.readout {\n\t\tmargin: 0;\n\t\tfont-family: var(--iv_font-mono);\n\t\tfont-size: var(--iv_text-sm);\n\t\tcolor: var(--iv_foreground-dim);\n\t}\n</style>"},{"id":"searchable","title":"Searchable","description":"`searchable` filters the list as you type.","code":"<script lang=\"ts\">\n\timport { Select } from '@elluzion/iv-ui';\n\n\tlet member = $state('');\n\n\tconst options = [\n\t\t'Ada Lovelace',\n\t\t'Grace Hopper',\n\t\t'Alan Turing',\n\t\t'Katherine Johnson',\n\t\t'Margaret Hamilton',\n\t\t'Radia Perlman'\n\t];\n</script>\n\n<div class=\"field-row\">\n\t<Select label=\"Reviewer\" searchable placeholder=\"Search people…\" {options} bind:value={member} />\n</div>\n\n<style>\n\t.field-row {\n\t\twidth: 100%;\n\t\tmax-width: 320px;\n\t}\n</style>"},{"id":"states","title":"States","description":"Clearable, error, and disabled variants.","code":"<script lang=\"ts\">\n\timport { Select } from '@elluzion/iv-ui';\n\n\tlet region = $state('eu-west');\n\tlet environment = $state('');\n</script>\n\n<div class=\"stack\">\n\t<Select\n\t\tlabel=\"Region\"\n\t\tclearable\n\t\toptions={['eu-west', 'us-east', 'ap-south']}\n\t\tbind:value={region}\n\t/>\n\t<Select\n\t\tlabel=\"Environment\"\n\t\tplaceholder=\"Choose an environment\"\n\t\toptions={['staging', 'production']}\n\t\tbind:value={environment}\n\t\terror=\"An environment is required.\"\n\t/>\n\t<Select label=\"Organization\" options={['orbital']} value=\"orbital\" disabled />\n</div>\n\n<style>\n\t.stack {\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\tgap: var(--iv_spacing-lg);\n\t\twidth: 100%;\n\t\tmax-width: 320px;\n\t}\n</style>"}],"markdown":"/components/select.md","page":"/components/select"}