dssoca docs
GitHub repository

Select

Styled native dropdown.

A native `<select>` wrapped in the shared field chrome — best-in-class keyboard and mobile a11y, with a custom CSS chevron and zero runtime deps. Pass a flat `options` list or grouped `SelectOptGroup[]` (auto-detected); add a `placeholder` for an empty first choice, and wire `hint`/`error` text via `aria-describedby` exactly like `Input`.

Demo

live · storybook Open in Storybook

Demo loads from https://dssoca-storybook.vercel.app/. Run pnpm storybook for it to render locally.

Usage

svelte
<script>
  import { Select } from 'dssoca';

  let country = $state('');
  const options = [
    { value: 'us', label: 'United States' },
    { value: 'ca', label: 'Canada' },
  ];
</script>

<Select label="Country" bind:value={country} {options} placeholder="Select a country…" />

Props

PropTypeDefaultDescription
optionsSelectOption[] | SelectOptGroup[][]Flat options, or grouped options (detected by an `options` array on the first element).
valuestring''Bindable selected value (`bind:value`).
labelstringLabel text; rendered as <label> wired to the select.
idstringSelect id; auto-generated for label association when unset.
namestringNative form field name.
placeholderstringDisabled, hidden first option, selected while the value is empty.
requiredbooleanfalseMarks the field required.
disabledbooleanfalseRenders the select non-interactive.
invalidbooleanMarks the field invalid for assistive tech (aria-invalid).
hintstringHelper text under the field, wired via aria-describedby.
errorstringError text under the field; implies aria-invalid and is announced to AT (role="alert").
describedbystringExtra id(s) appended to aria-describedby after error/hint.
onchange(e: Event) => voidNative change handler; fired on selection.
size'sm' | 'md' | 'lg'Per-instance size override; inherits the ancestor `data-size-variant` when unset.