SelectProps
Props of Select: the options, the chosen value, and a placeholder.
Utilização
Choose a size
Este tipo é usado por 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>
);
}Declaração do tipo
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;
};Membros 5
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
options | SelectOption[] | Sim | In the order the menu lists them; each value names one option. |
value | string | Não | 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 | Não | What it shows while no option is chosen. |
disabled | boolean | Não | — |
onChange | (value: string) => void | Não | The value of the option the user picked. |
onChange — assinaturas de método
Assinaturas
(value: string): voidParâmetros
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
value | string | Sim | — |
Devolve
void
Gerado a partir das declarações TypeScript públicas: assinaturas, props e predefinições vêm da fonte verificada, as descrições da sua JSDoc. Nenhuma predefinição é inventada.