Spaces:
Sleeping
Sleeping
File size: 1,158 Bytes
15975c4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
import { Stack, Typography, Switch, FormControlLabel } from '@mui/material';
import { useState } from 'react';
export const SwitchView = () => {
const [status, setStatus] = useState(true);
return (
<Stack spacing={3}>
<Typography variant="h6" fontWeight="bold">
Switch
</Typography>
<Stack direction="row" spacing={1} alignItems={'center'}>
<FormControlLabel
control={
<Switch
checked={status}
onChange={() => { setStatus(!status) }}
name="status"
/>
}
label={status ? "On" : "Off"}
/>
<FormControlLabel control={<Switch />} label="Uncontrolled" />
<FormControlLabel disabled control={<Switch />} label="Disabled" />
<FormControlLabel
disabled
control={<Switch checked />}
label="Disabled"
/>
</Stack>
</Stack>
);
}; |