SelectProps
Props of Select: the options, the chosen value, and a placeholder.
Verwendung
Choose a size
Dieser Typ wird verwendet von Select
import { Select, Text, VStack, signal } from 'kuito';
const SIZES = [
{ value: 's', label: 'Small' },
{ value: 'm', label: 'Medium' },
{ value: 'l', label: 'Large' },
];
export default function Size() {
const size = signal<string | undefined>(undefined);
return (
<VStack gap={8} padding={16}>
<Select label="Size" options={SIZES} value={size} placeholder="Choose a size" height={44} />
<Text>{size.value ?? 'No size yet'}</Text>
</VStack>
);
}Typdeklaration
export type SelectProps = {
/** In the order the menu lists them; each value names one option. */
options: SelectOption[];
/**
* The chosen option's value; none while it names no option. Two-way when
* given a signal: the select writes it as the user picks.
*/
value?: string;
/** What it shows while no option is chosen. */
placeholder?: string;
disabled?: boolean;
/** The value of the option the user picked. */
onChange?: (value: string) => void;
};Mitglieder 5
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
options | SelectOption[] | Ja | In the order the menu lists them; each value names one option. |
value | string | Nein | The chosen option's value; none while it names no option. Two-way when given a signal: the select writes it as the user picks. |
placeholder | string | Nein | What it shows while no option is chosen. |
disabled | boolean | Nein | — |
onChange | (value: string) => void | Nein | The value of the option the user picked. |
onChange — Methodensignaturen
Signaturen
(value: string): voidParameter
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
value | string | Ja | — |
Rückgabe
void
Generiert aus den öffentlichen TypeScript-Deklarationen: Signaturen, Props und Standardwerte stammen aus der geprüften Quelle, Beschreibungen aus deren JSDoc. Kein Standardwert ist erfunden.