SegmentedControlProps
Props of SegmentedControl: a segment per option, and the chosen value.
Utilisation
Switch between day, week and month
Ce type est utilisé par SegmentedControl
import { SegmentedControl, Text, VStack, signal } from 'kuito';
const VIEWS = [
{ value: 'day', label: 'Day' },
{ value: 'week', label: 'Week' },
{ value: 'month', label: 'Month' },
];
export default function Plan() {
const view = signal('week');
return (
<VStack gap={8} padding={16}>
<SegmentedControl label="View" options={VIEWS} value={view} height={32} />
<Text>{view.value}</Text>
</VStack>
);
}Déclaration du type
export type SegmentedControlProps = {
/** A segment each, in order; each value names one option. */
options: SelectOption[];
/**
* The chosen segment's value; none selected while it names no option.
* Two-way when given a signal: the control writes it as the user picks.
*/
value?: string;
disabled?: boolean;
/** The value of the segment the user picked. */
onChange?: (value: string) => void;
};Membres 4
| Nom | Type | Requis | Description |
|---|---|---|---|
options | SelectOption[] | Oui | A segment each, in order; each value names one option. |
value | string | Non | The chosen segment's value; none selected while it names no option. Two-way when given a signal: the control writes it as the user picks. |
disabled | boolean | Non | — |
onChange | (value: string) => void | Non | The value of the segment 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.