Skip to content

malcodeman/react-button-group

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub license npm code style: prettier

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.

Getting started

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;

License

MIT

About

A button group is a set of two or more button segments.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages