AccueilComponentsSwitch

Switch

Interrupteur avec label, supportant les modes contrôlé et non-contrôlé.
ui
Default
tsx
export const Default = () => (
<Box display="flex" flexDirection="column" gap="3W">
<Switch label="Non activé" />
<Switch label="Activé" checked />
<Switch label="Désactivé" disabled />
<Switch label="Activé désactivé" checked disabled />
</Box>
);
Sizes
tsx
export const Sizes = () => (
<Box display="flex" flexDirection="column" gap="3W">
<Switch label="Sm" size="sm" checked />
<Switch label="Md" size="md" checked />
<Switch label="Lg" size="lg" checked />
</Box>
);
Controlled
tsx
export const Controlled = () => {
const [value, setValue] = useState(false);
return <Switch label={value ? 'Activé' : 'Désactivé'} checked={value} onCheckedChange={v => setValue(!!v)} />;
};
Alveole UI Kit — v2.0.0-alpha.30