Button Group
A Button Group component groups multiple buttons together for selecting from a set of related actions or options.
Demo
Demo Coming Soon
ButtonGroup examples will be available soon.
Usage
import { useState } from 'react';import { NButtonGroup } from '@nayan-ui/react';const items = ['Startup', 'Business', 'Enterprise'];const ButtonGroup = () => {const [selected, setSelected] = useState(items[0]);return <NButtonGroup disabled={false} items={items} selected={selected} onChange={setSelected} />;};export default ButtonGroup;
Attributes
| Name | Type | Default | Details |
|---|---|---|---|
| items | ButtonGroupItem[] | Required | Array of items with label, value, optional icon and isDisabled. |
| value | string | Required | Currently selected value. |
| onValueChange | (value: string) => void | Required | Callback when selection changes. |
| label | string | Optional | Label for the button group. |
| isDisabled | boolean | false | Whether the button group is disabled. |
| className | string | ' ' | You can customise by passing tailwind classes. |
| buttonClassName | string | ' ' | You can customise by passing tailwind classes. |
| labelClassName | string | ' ' | You can customise by passing tailwind classes. |