Skip to content

Commit e6d457b

Browse files
feat(@clayui/button): add api for stacking button group vertically
1 parent d7e0046 commit e6d457b

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

packages/clay-button/src/Group.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,27 @@ export interface IButtonGroupProps
1212
* Flag to indicate the spacing between the buttons.
1313
*/
1414
spaced?: boolean;
15+
16+
/**
17+
* Flag to indicate if buttons are stacked vertically.
18+
*/
19+
vertical?: boolean;
1520
}
1621

1722
const ClayButtonGroup: React.FunctionComponent<IButtonGroupProps> = ({
1823
children,
1924
className,
2025
role = 'group',
2126
spaced,
27+
vertical,
2228
...otherProps
2329
}: IButtonGroupProps) => (
2430
<div
2531
{...otherProps}
26-
className={classNames(className, 'btn-group')}
32+
className={classNames(
33+
className,
34+
vertical ? 'btn-group-vertical' : 'btn-group'
35+
)}
2736
role={role}
2837
>
2938
{spaced

packages/clay-button/stories/index.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,15 @@ storiesOf('Components|ClayButton', module)
4545
<ClayButton>{'group.'}</ClayButton>
4646
</ClayButton.Group>
4747
))
48+
.add('button group vertical', () => (
49+
<ClayButton.Group spaced={boolean('Spaced', false) as false} vertical>
50+
<ClayButton>{'This'}</ClayButton>
51+
<ClayButton displayType="secondary">{'is'}</ClayButton>
52+
<ClayButton>{'a'}</ClayButton>
53+
<ClayButton displayType="secondary">{'button'}</ClayButton>
54+
<ClayButton>{'group.'}</ClayButton>
55+
</ClayButton.Group>
56+
))
4857
.add('ButtonWithIcon', () => (
4958
<>
5059
<ClayButtonWithIcon

0 commit comments

Comments
 (0)