Capgemini / dcx-react-library

React Library UI/UX agnostic
https://main--6069a6f47f4b9f002171f8e1.chromatic.com
MIT License
113 stars 7 forks source link

ButtonGroup #458

Closed daniele-zurico closed 6 months ago

daniele-zurico commented 1 year ago

As a developer I want to be able to use a ButtonGroup component so that I can easily group multiple buttons

The component should contains:

The final user will use in this way:

<ButtonGroup className="button-group" {...props}>
  <Button>One</Button>
  <Button>Two</Button>
  <Button>Three</Button>
</ButtonGroup>

behind the scenes the buttonGroup component is a div with role group:

<div role="group" ...>

Important: you don't need to reimplement the Button component given is already available in the library

Tasks:

Please follow the below to create your branch

git checkout release/1.0.0
git pull
git checkout -b 'feature/button-group'
alexwbbr commented 7 months ago

The base component and tests are here for a simple button group that groups buttons together into one pill shape. https://github.com/Capgemini/dcx-react-library/pull/541

However after several talks with @daniele-zurico he wishes the button group to behave a bit more like the angular material button group: https://material.angular.io/components/button-toggle/overview

where after you have clicked a button in the group a class gets added to the button the user last interacted with, which can be used to change how that button looks.

My original branch can be used as a starting point, the component would need to keep track of the button the user last clicked in the group along with adding a class to that button.

In particular, we want:

daniele-zurico commented 6 months ago

Closed by #541