Select

A native select input with custom styling.

Installation

bash
npx @smicolon/cli add select

Run init once per project before adding components. See Installation.

Preview

Sizes

States

Props

PropTypeDefaultDescription
optionsSelectOption[]—Options to choose from.
placeholderstring—Text shown before a choice.
selectSize"sm" | "default" | "lg""default"Select size.
errorbooleanfalseMarks the select as invalid.
disabledbooleanfalseDisables the select and dims it.
valuestring—Selected value. Use it with onChange.
namestring—Name submitted with the form.
onChange(event) => void—Called when the choice changes.
classNamestring—Extra classes for the component.

Usage

tsx
import { Select } from "@/components/ui/select"

const options = [
  { value: "riyadh", label: "Riyadh" },
  { value: "jeddah", label: "Jeddah" },
  { value: "dammam", label: "Dammam" },
]

// Basic select
<Select
  options={options}
  placeholder="Select a city"
/>

// Different sizes
<Select options={options} selectSize="sm" />
<Select options={options} selectSize="default" />
<Select options={options} selectSize="lg" />

// Error state
<Select options={options} error />