Files
react-test/docs/data/joy/components/checkbox/HoverCheckbox.tsx

24 lines
559 B
TypeScript
Raw Normal View History

2025-12-12 14:26:25 +09:00
import Checkbox from '@mui/joy/Checkbox';
import Done from '@mui/icons-material/Done';
export default function HoverCheckbox() {
return (
<Checkbox
uncheckedIcon={<Done />}
label="My unchecked icon appears on hover"
slotProps={{
root: ({ checked, focusVisible }) => ({
sx: !checked
? {
'& svg': { opacity: focusVisible ? 1 : 0 },
'&:hover svg': {
opacity: 1,
},
}
: undefined,
}),
}}
/>
);
}