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
41 lines
1.3 KiB
TypeScript
41 lines
1.3 KiB
TypeScript
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 ToggleButton from '@mui/material/ToggleButton';
|
|
import ToggleButtonGroup from '@mui/material/ToggleButtonGroup';
|
|
|
|
export default function ToggleButtons() {
|
|
const [alignment, setAlignment] = React.useState<string | null>('left');
|
|
|
|
const handleAlignment = (
|
|
event: React.MouseEvent<HTMLElement>,
|
|
newAlignment: string | null,
|
|
) => {
|
|
setAlignment(newAlignment);
|
|
};
|
|
|
|
return (
|
|
<ToggleButtonGroup
|
|
value={alignment}
|
|
exclusive
|
|
onChange={handleAlignment}
|
|
aria-label="text alignment"
|
|
>
|
|
<ToggleButton value="left" aria-label="left aligned">
|
|
<FormatAlignLeftIcon />
|
|
</ToggleButton>
|
|
<ToggleButton value="center" aria-label="centered">
|
|
<FormatAlignCenterIcon />
|
|
</ToggleButton>
|
|
<ToggleButton value="right" aria-label="right aligned">
|
|
<FormatAlignRightIcon />
|
|
</ToggleButton>
|
|
<ToggleButton value="justify" aria-label="justified" disabled>
|
|
<FormatAlignJustifyIcon />
|
|
</ToggleButton>
|
|
</ToggleButtonGroup>
|
|
);
|
|
}
|