Skip to content

Commit e148abd

Browse files
mohammedkhadarlevithomason
authored andcommitted
feat(Button): add floated prop to Button.Group (#1246)
* feat(Button): add `floated` prop to Button.Group * docs(Button): add example for `floated` Button.Group
1 parent 6c36b91 commit e148abd

File tree

4 files changed

+30
-0
lines changed

4 files changed

+30
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import React from 'react'
2+
import { Button } from 'semantic-ui-react'
3+
4+
const ButtonExampleGroupFloated = () => (
5+
<div>
6+
<Button.Group floated='left'>
7+
<Button>One</Button>
8+
<Button>Two</Button>
9+
<Button>Three</Button>
10+
</Button.Group>
11+
<Button.Group floated='right'>
12+
<Button>One</Button>
13+
<Button>Two</Button>
14+
<Button>Three</Button>
15+
</Button.Group>
16+
</div>
17+
)
18+
19+
export default ButtonExampleGroupFloated

docs/app/Examples/elements/Button/GroupVariations/index.js

+5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ import ExampleSection from 'docs/app/Components/ComponentDoc/ExampleSection'
44

55
const ButtonGroupVariationsExamples = () => (
66
<ExampleSection title='Group Variations'>
7+
<ComponentExample
8+
title='Floated Group'
9+
description='Groups can be aligned to the left or right of its container.'
10+
examplePath='elements/Button/GroupVariations/ButtonExampleGroupFloated'
11+
/>
712
<ComponentExample
813
title='Vertical Group'
914
description='Groups can be formatted to appear vertically.'

src/elements/Button/ButtonGroup.js

+5
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ function ButtonGroup(props) {
2323
className,
2424
color,
2525
compact,
26+
floated,
2627
fluid,
2728
icon,
2829
inverted,
@@ -54,6 +55,7 @@ function ButtonGroup(props) {
5455
useKeyOnly(toggle, 'toggle'),
5556
useKeyOnly(vertical, 'vertical'),
5657
useValueAndKey(attached, 'attached'),
58+
useValueAndKey(floated, 'floated'),
5759
useWidthProp(widths),
5860
'buttons',
5961
className,
@@ -92,6 +94,9 @@ ButtonGroup.propTypes = {
9294
/** Groups can reduce their padding to fit into tighter spaces. */
9395
compact: PropTypes.bool,
9496

97+
/** Groups can be aligned to the left or right of its container. */
98+
floated: PropTypes.oneOf(SUI.FLOATS),
99+
95100
/** Groups can take the width of their container. */
96101
fluid: PropTypes.bool,
97102

test/specs/elements/Button/ButtonGroup-test.js

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ describe('ButtonGroup', () => {
1010
common.implementsWidthProp(ButtonGroup, { propKey: 'widths', widthClass: 'buttons', canEqual: false })
1111

1212
common.propKeyAndValueToClassName(ButtonGroup, 'attached')
13+
common.propKeyAndValueToClassName(ButtonGroup, 'floated')
1314

1415
common.propKeyOnlyToClassName(ButtonGroup, 'basic')
1516
common.propKeyOnlyToClassName(ButtonGroup, 'compact')

0 commit comments

Comments
 (0)