Skip to content

Commit 21d67b9

Browse files
committed
Customize each button with buttonProps
1 parent a5577c6 commit 21d67b9

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

src/components/button/buttonGroup.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,14 @@ const Content = ({ children }) => {
3232
)
3333
}
3434

35-
const RadioButtons = ({ items, value, isMulti, buttonProps = {}, onChange }) => {
35+
const RadioButtons = ({
36+
items,
37+
value,
38+
isMulti,
39+
ButtonComponent = Button,
40+
buttonProps = {},
41+
onChange,
42+
}) => {
3643
return (
3744
<>
3845
{items.map((item, index) => {
@@ -54,14 +61,15 @@ const RadioButtons = ({ items, value, isMulti, buttonProps = {}, onChange }) =>
5461
}
5562

5663
return (
57-
<Button
64+
<ButtonComponent
5865
key={item.value}
5966
label={item.label}
6067
onClick={onClick}
6168
{...(item.title ? { title: item.title } : {})}
6269
{...(!isSelected ? { flavour: "hollow" } : {})}
6370
{...buttonGroupProps}
6471
{...buttonProps}
72+
{...(item.buttonProps || {})}
6573
/>
6674
)
6775
})}
@@ -75,6 +83,7 @@ export const ButtonGroup = ({
7583
isMulti,
7684
onChange = noop,
7785
children,
86+
ButtonComponent,
7887
buttonProps,
7988
...props
8089
}) => (
@@ -85,6 +94,7 @@ export const ButtonGroup = ({
8594
value={value}
8695
isMulti={isMulti}
8796
onChange={onChange}
97+
ButtonComponent={ButtonComponent}
8898
buttonProps={buttonProps}
8999
/>
90100
) : (

0 commit comments

Comments
 (0)