A button group is a set of two or more button segments. Within the control, all segments are equal in width. A button group is often used to switch between views of some data.
yarn add @malcodeman/react-button-group
# or
npm install --save @malcodeman/react-button-group
import React from "react";
import { ButtonGroup } from "@malcodeman/react-button-group";
function App() {
const [selected, setSelected] = React.useState([0]);
return (
<div>
<ButtonGroup
selected={selected}
onClick={(event, index) => {
setSelected([index]);
}}
>
<StyledButton>One</StyledButton>
<StyledButton>Two</StyledButton>
<StyledButton>Three</StyledButton>
</ButtonGroup>
</div>
);
}
export default App;