Skip to content

Commit 64b78a5

Browse files
committed
feat(v5): Drop toggle prop from ButtonGroup
1 parent 457f42f commit 64b78a5

File tree

6 files changed

+6
-22
lines changed

6 files changed

+6
-22
lines changed

src/ButtonGroup.tsx

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
export interface ButtonGroupProps extends BsPrefixPropsWithChildren {
1212
role?: string;
1313
size?: 'sm' | 'lg';
14-
toggle?: boolean;
1514
vertical?: boolean;
1615
}
1716

@@ -33,13 +32,6 @@ const propTypes = {
3332
/** Make the set of Buttons appear vertically stacked. */
3433
vertical: PropTypes.bool,
3534

36-
/**
37-
* Display as a button toggle group.
38-
*
39-
* (Generally it's better to use `ToggleButtonGroup` directly)
40-
*/
41-
toggle: PropTypes.bool,
42-
4335
/**
4436
* An ARIA role describing the button group. Usually the default
4537
* "group" role is fine. An `aria-label` or `aria-labelledby`
@@ -52,7 +44,6 @@ const propTypes = {
5244

5345
const defaultProps = {
5446
vertical: false,
55-
toggle: false,
5647
role: 'group',
5748
};
5849

@@ -61,7 +52,6 @@ const ButtonGroup: ButtonGroup = React.forwardRef(
6152
{
6253
bsPrefix,
6354
size,
64-
toggle,
6555
vertical,
6656
className,
6757
// Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
@@ -83,7 +73,6 @@ const ButtonGroup: ButtonGroup = React.forwardRef(
8373
className,
8474
baseClass,
8575
size && `${prefix}-${size}`,
86-
toggle && `${prefix}-toggle`,
8776
)}
8877
/>
8978
);

src/ToggleButtonGroup.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ const ToggleButtonGroup: ToggleButtonGroup<any> = (React.forwardRef(
120120
);
121121

122122
return (
123-
<ButtonGroup {...controlledProps} ref={ref as any} toggle>
123+
<ButtonGroup {...controlledProps} ref={ref as any}>
124124
{map(children, (child) => {
125125
const values = getValues();
126126
const { value: childVal, onChange: childOnChange } = child.props;

test/ButtonGroupSpec.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,6 @@ describe('ButtonGroup', () => {
3030
.assertNone('.btn-group');
3131
});
3232

33-
it('Should add toggle variation', () => {
34-
mount(
35-
<ButtonGroup toggle>
36-
<Button>Title</Button>
37-
</ButtonGroup>,
38-
).assertSingle('.btn-group.btn-group-toggle');
39-
});
40-
4133
it('Should have div as default component', () => {
4234
mount(<ButtonGroup />).assertSingle('div');
4335
});

tests/simple-types-test.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ const MegaComponent = () => (
136136
as="div"
137137
role="group"
138138
size="lg"
139-
toggle
140139
vertical
141140
bsPrefix="btn-group"
142141
style={style}

www/src/pages/components/buttons.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ The above handles styling, But requires manually controlling the
105105

106106

107107
For a nicer experience with checked state management use the
108-
`<ToggleButtonGroup>` instead of a `<ButtonGroup toggle>` component.
108+
`<ToggleButtonGroup>` instead of a `<ButtonGroup>` component.
109109
The group behaves as a form component, where the `value` is an array of the selected
110110
`value`s for a named checkbox group or the single toggled
111111
`value` in a similarly named radio group.

www/src/pages/migrating.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ there may be a React-Bootstrap v3 targeting Bootstrap 6 depending on what's best
2828

2929
Below is a _rough_ account of the breaking API changes as well as the minimal change to migrate
3030

31+
### ButtonGroup
32+
33+
- removed `toggle`.
34+
3135
### Form
3236

3337
- removed `inline`.

0 commit comments

Comments
 (0)