Motoko UI Released — Explore the components
Motoko UI

Select

A compound dropdown with Motoko surface styles and a simple options kit.

Installation

pnpm dlx shadcn@latest add @motokoui/select

Usage

Compound API

import {
  Select,
  SelectContent,
  SelectItem,
  SelectTrigger,
  SelectValue,
} from "@/components/ui/select"
 
export default function Example() {
  return (
    <Select defaultValue="system" placeholder="Theme">
      <SelectTrigger>
        <SelectValue />
      </SelectTrigger>
      <SelectContent>
        <SelectItem value="light">Light</SelectItem>
        <SelectItem value="dark">Dark</SelectItem>
        <SelectItem value="system">System</SelectItem>
      </SelectContent>
    </Select>
  )
}

Options kit

When you only need a flat list of options, use SelectKit:

import { SelectKit } from "@/components/ui/select"
 
export default function Example() {
  return (
    <SelectKit
      placeholder="Pick a fruit"
      options={[
        { value: "apple", label: "Apple" },
        { value: "banana", label: "Banana" },
      ]}
    />
  )
}

Anatomy

<Select>
  <SelectTrigger>
    <SelectValue />
  </SelectTrigger>
  <SelectContent>
    <SelectItem />
  </SelectContent>
</Select>

Props

Select

PropTypeDefault
valuestring
defaultValuestring""
onValueChange(value: string) => void
placeholderReactNode"Select…"
disabledbooleanfalse
classNamestring

SelectTrigger

PropTypeDefault
size"sm" | "default""default"
disabledbooleanfalse

SelectItem

PropTypeDefault
valuestringrequired
disabledbooleanfalse

SelectKit

PropTypeDefault
options{ value: string; label: ReactNode }[]required
valuestring
defaultValuestring
onValueChange(value: string) => void
placeholderReactNode
disabledbooleanfalse
classNamestring
classNameTriggerstring
size"sm" | "default""default"