0.0.2 • Published 8 months ago

@licuido-ui/ui_button-group v0.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago

ButtonGroup

The ButtonGroup component provides a group of buttons, allowing users to select one option from a set of choices. The selected button is highlighted with a specified color, while unselected buttons have a different background color. This component is useful for creating interactive UI elements, such as filters, tabs, or toggles.

Author

Link

Story Book Link ButtonGroup

PlayGround

Try it have a fun codeBox

Installation

npm i @licuido-ui/ui_button-group

Import component

import { ButtonGroup } from '@licuido-ui/ui_button-group';

Usage

<ButtonGroup buttons={[]} />

Image

buttonGroup

Sample Code

<ButtonGroup
  buttons={buttons}
  onClick={handleButtonClick}
  selectedColor='#fff'
  selectedBgColor='blue'
  unselectBgColor='lightgray'
  color='black'
  fontSize='16px'
  fontWeight='bold'
  variant='contained'
/>

Props

Prop NameTypeDefaultDescription
idThis id unique and To run BDD test , also applied in data-idstringstring
buttonsButtonItem[][]An array of button items, each with a label and value.
onClick(e: MouseEvent<HTMLButtonElement>, value: number) => void() => falseCallback function when a button is clicked.
variant'outlined' \| 'contained''contained'The style variant for the buttons. Possible values are 'outlined' or 'contained'.
size'small' \| 'medium' \| 'large''medium'The size of the buttons. Possible values are 'small', 'medium', or 'large'.
disabledbooleanfalseWhether the button group is disabled or not.
selectedColorstring''The text color of the selected button.
unselectBgColorstring''The background color of unselected buttons when variant is 'contained'.
colorstring'#fff'The text color of unselected buttons when variant is 'contained'.
selectedBgColorstring''The background color of the selected button when variant is 'contained'.
fontSizestring \| number''The font size of the buttons.
fontWeightstring \| number''The font weight of the buttons.
btnStyleSxProps{}Custom style object for individual buttons.
rootstyleSxProps{}Custom style object for the root container.
btnGroupStyleSxProps{}Custom style object for the MuiButtonGroup container.
classNamestring''Additional CSS class name for the root container.
sxSxProps{}Custom style object using MUI's sx prop.

ButtonItem

Prop NameTypeDefaultDescription
labelstring-The label text of the button.
valuenumber-The value associated with the button.
startIconReactNodeundefinedThe start icon of the button (optional).
endIconReactNodeundefinedThe end icon of the button (optional).
isdisabledtrue \| falseundefinedWhether the button is disabled (optional).