Swirski UI

Forms

Select

A custom dropdown picker for option sets, playground controls and compact forms.

Component

06

Request Changes

Import

import { Select } from "@swirski/ui";

Composition

Field
|-- Label
|-- Select
|   `-- options[]
|       |-- value
|       `-- label
`-- FieldHint | FieldError

Playground

3 controls

Controls

Usage

<Select
  placeholder="Pick a tone"
  defaultValue="yellow"
  options={[
    { value: "yellow", label: "Yellow" },
    { value: "blue", label: "Blue" },
    { value: "red", label: "Red" },
    { value: "white", label: "White" },
  ]}
/>

Props

30 generated
PropTypeDefaultNotes
Select.contentClassNamestring-Adds classes to the dropdown content panel.
Select.defaultValuestring-Initial selected option value when uncontrolled.
Select.disabledbooleanfalseDisables the trigger and prevents selection.
Select.namestring-Adds a hidden input for native form submission.
Select.onValueChange((value: string) => void)-Called when a new option is selected.
Select.optionClassNamestring-Adds classes to each dropdown option.
Select.optionsRequiredSelectOption[]-Options shown in the dropdown list.
Select.placeholderstring"Select an option"Text shown when no option is selected.
Select.selectedIndicatorReactNode"x"Generated from SelectProps.
Select.showSelectedIndicatorbooleanfalseGenerated from SelectProps.
Select.size'sm' | 'md' | 'lg'"md"Generated from SelectProps.
Select.tone'default'"default"Generated from SelectProps.
Select.triggerClassNamestring-Adds classes to the dropdown trigger.
Select.valuestring-Controlled selected option value.
Select.variant'default' | 'filled'"default"Generated from SelectProps.
SelectContent.contentClassNamestring-Adds classes to the dropdown content panel.
SelectContent.contentRefRequiredRef<HTMLDivElement>-Generated from SelectContentProps.
SelectContent.contentStyleRequiredCSSProperties-Generated from SelectContentProps.
SelectContent.highlightedIndexRequirednumber-Generated from SelectContentProps.
SelectContent.listboxIdRequiredstring-Generated from SelectContentProps.
SelectContent.onOptionHoverRequired(index: number) => void-Generated from SelectContentProps.
SelectContent.onOptionSelectRequired(value: string) => void-Generated from SelectContentProps.
SelectContent.optionClassNamestring-Adds classes to each dropdown option.
SelectContent.optionsRequiredSelectOption[]-Options shown in the dropdown list.
SelectContent.selectedIndicatorRequiredReactNode-Generated from SelectContentProps.
SelectContent.selectedValueRequiredstring-Generated from SelectContentProps.
SelectContent.showSelectedIndicatorRequiredboolean-Generated from SelectContentProps.
SelectContent.sizeRequired'sm' | 'md' | 'lg'-Generated from SelectContentProps.
SelectContent.toneRequired'default'-Generated from SelectContentProps.
SelectContent.variantRequired'default' | 'filled'-Generated from SelectContentProps.
Previous: FieldNext: Checkbox