SelectProps
Props of Select: the options, the chosen value, and a placeholder.
Utilisation
Choose a size
Ce type est utilisé par 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>
);
}Déclaration du type
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;
};Membres 5
| Nom | Type | Requis | Description |
|---|---|---|---|
options | SelectOption[] | Oui | In the order the menu lists them; each value names one option. |
value | string | Non | 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 | Non | What it shows while no option is chosen. |
disabled | boolean | Non | — |
onChange | (value: string) => void | Non | The value of the option the user picked. |
onChange — signatures de méthode
Signatures
(value: string): voidParamètres
| Nom | Type | Requis | Description |
|---|---|---|---|
value | string | Oui | — |
Retourne
void
Généré depuis les déclarations TypeScript publiques : signatures, props et valeurs par défaut viennent de la source vérifiée, les descriptions de sa JSDoc. Aucune valeur par défaut n'est inventée.