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
52 lines
1.6 KiB
JavaScript
52 lines
1.6 KiB
JavaScript
import * as React from 'react';
|
|
import FormatAlignLeftIcon from '@mui/icons-material/FormatAlignLeft';
|
|
import FormatAlignCenterIcon from '@mui/icons-material/FormatAlignCenter';
|
|
import FormatAlignRightIcon from '@mui/icons-material/FormatAlignRight';
|
|
import FormatAlignJustifyIcon from '@mui/icons-material/FormatAlignJustify';
|
|
import Stack from '@mui/material/Stack';
|
|
import ToggleButton from '@mui/material/ToggleButton';
|
|
import ToggleButtonGroup from '@mui/material/ToggleButtonGroup';
|
|
|
|
export default function ToggleButtonSizes() {
|
|
const [alignment, setAlignment] = React.useState('left');
|
|
|
|
const handleChange = (event, newAlignment) => {
|
|
setAlignment(newAlignment);
|
|
};
|
|
|
|
const children = [
|
|
<ToggleButton value="left" key="left">
|
|
<FormatAlignLeftIcon />
|
|
</ToggleButton>,
|
|
<ToggleButton value="center" key="center">
|
|
<FormatAlignCenterIcon />
|
|
</ToggleButton>,
|
|
<ToggleButton value="right" key="right">
|
|
<FormatAlignRightIcon />
|
|
</ToggleButton>,
|
|
<ToggleButton value="justify" key="justify">
|
|
<FormatAlignJustifyIcon />
|
|
</ToggleButton>,
|
|
];
|
|
|
|
const control = {
|
|
value: alignment,
|
|
onChange: handleChange,
|
|
exclusive: true,
|
|
};
|
|
|
|
return (
|
|
<Stack spacing={2} sx={{ alignItems: 'center' }}>
|
|
<ToggleButtonGroup size="small" {...control} aria-label="Small sizes">
|
|
{children}
|
|
</ToggleButtonGroup>
|
|
<ToggleButtonGroup {...control} aria-label="Medium sizes">
|
|
{children}
|
|
</ToggleButtonGroup>
|
|
<ToggleButtonGroup size="large" {...control} aria-label="Large sizes">
|
|
{children}
|
|
</ToggleButtonGroup>
|
|
</Stack>
|
|
);
|
|
}
|