Files
react-test/docs/data/joy/components/toggle-button-group/ToggleButtons.js
how2ice 005cf56baf
Some checks failed
No response / noResponse (push) Has been cancelled
CI / Continuous releases (push) Has been cancelled
CI / test-dev (macos-latest) (push) Has been cancelled
CI / test-dev (ubuntu-latest) (push) Has been cancelled
CI / test-dev (windows-latest) (push) Has been cancelled
Maintenance / main (push) Has been cancelled
Scorecards supply-chain security / Scorecards analysis (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
init project
2025-12-12 14:26:25 +09:00

42 lines
1.2 KiB
JavaScript

import * as React from 'react';
import Button from '@mui/joy/Button';
import IconButton from '@mui/joy/IconButton';
import Stack from '@mui/joy/Stack';
import FormatBold from '@mui/icons-material/FormatBold';
export default function ToggleButtons() {
const [pressed, setPressed] = React.useState(false);
return (
<Stack spacing={2} direction="row">
<Button
variant="outlined"
color="neutral"
onClick={() => setPressed(!pressed)}
aria-pressed={pressed ? 'true' : 'false'}
sx={(theme) => ({
[`&[aria-pressed="true"]`]: {
...theme.variants.outlinedActive.neutral,
borderColor: theme.vars.palette.neutral.outlinedHoverBorder,
},
})}
>
Button
</Button>
<IconButton
variant="outlined"
color="neutral"
onClick={() => setPressed(!pressed)}
aria-pressed={pressed ? 'true' : 'false'}
sx={(theme) => ({
[`&[aria-pressed="true"]`]: {
...theme.variants.outlinedActive.neutral,
borderColor: theme.vars.palette.neutral.outlinedHoverBorder,
},
})}
>
<FormatBold />
</IconButton>
</Stack>
);
}