Skip to content

Forms

Select

One choice out of a short list.

Installation

Terminal
pnpm add @elsikora/keystone-ui-kit

Usage

Import
import { SelectContent, Select, SelectValue, SelectItem } from "@elsikora/keystone-ui-kit";
docs/select/default.example.tsx
import { Field, Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@elsikora/keystone-ui-kit";
export default function SelectDefaultExample() {  return (    <Field label="Currency">      <Select defaultValue="eur">        <SelectTrigger>          <SelectValue />        </SelectTrigger>        <SelectContent>          <SelectItem value="eur">Euro</SelectItem>          <SelectItem value="usd">US dollar</SelectItem>          <SelectItem value="gbp">Pound sterling</SelectItem>        </SelectContent>      </Select>    </Field>  );}

Examples

Default

With a placeholder

Groups

Groups with a heading each; the heading is read with its items.

API reference

SelectContent

PropTypeDefaultDescription
containerElement | DocumentFragment | null-Where it opens; by default the nearest PortalRoot's element, else the body.

Select

PropTypeDefaultDescription
valuestring-The choice, when the caller holds the state.
defaultValuestring-The first choice, when the component holds it.
onValueChange(value: string) => void-Called on a new choice.
disabledbooleanfalseUnavailable.

SelectValue

PropTypeDefaultDescription
placeholderReactNode-Shown before a choice.

SelectItem

PropTypeDefaultDescription
valuestring-The value it chooses.

Notes

  • Arrow keys move, Enter or Space chooses, Escape closes, typing jumps to an item.