forked from mui/material-ui
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSwitchDecorators.js
More file actions
24 lines (23 loc) · 799 Bytes
/
SwitchDecorators.js
File metadata and controls
24 lines (23 loc) · 799 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import * as React from 'react';
import Switch from '@mui/joy/Switch';
import LocalFireDepartmentRoundedIcon from '@mui/icons-material/LocalFireDepartmentRounded';
import WavesRoundedIcon from '@mui/icons-material/WavesRounded';
export default function SwitchDecorators() {
const [dark, setDark] = React.useState(false);
return (
<Switch
color={dark ? 'primary' : 'danger'}
slotProps={{ input: { 'aria-label': 'dark mode' } }}
startDecorator={
<LocalFireDepartmentRoundedIcon
sx={{ color: dark ? 'text.tertiary' : 'danger.600' }}
/>
}
endDecorator={
<WavesRoundedIcon sx={{ color: dark ? 'primary.500' : 'text.tertiary' }} />
}
checked={dark}
onChange={(event) => setDark(event.target.checked)}
/>
);
}