Skip to content

Commit

Permalink
feat(v5): Drop toggle prop from ButtonGroup
Browse files Browse the repository at this point in the history
  • Loading branch information
kyletsang committed Aug 7, 2020
1 parent 457f42f commit 64b78a5
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 22 deletions.
11 changes: 0 additions & 11 deletions src/ButtonGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
export interface ButtonGroupProps extends BsPrefixPropsWithChildren {
role?: string;
size?: 'sm' | 'lg';
toggle?: boolean;
vertical?: boolean;
}

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

/**
* Display as a button toggle group.
*
* (Generally it's better to use `ToggleButtonGroup` directly)
*/
toggle: PropTypes.bool,

/**
* An ARIA role describing the button group. Usually the default
* "group" role is fine. An `aria-label` or `aria-labelledby`
Expand All @@ -52,7 +44,6 @@ const propTypes = {

const defaultProps = {
vertical: false,
toggle: false,
role: 'group',
};

Expand All @@ -61,7 +52,6 @@ const ButtonGroup: ButtonGroup = React.forwardRef(
{
bsPrefix,
size,
toggle,
vertical,
className,
// Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
Expand All @@ -83,7 +73,6 @@ const ButtonGroup: ButtonGroup = React.forwardRef(
className,
baseClass,
size && `${prefix}-${size}`,
toggle && `${prefix}-toggle`,
)}
/>
);
Expand Down
2 changes: 1 addition & 1 deletion src/ToggleButtonGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ const ToggleButtonGroup: ToggleButtonGroup<any> = (React.forwardRef(
);

return (
<ButtonGroup {...controlledProps} ref={ref as any} toggle>
<ButtonGroup {...controlledProps} ref={ref as any}>
{map(children, (child) => {
const values = getValues();
const { value: childVal, onChange: childOnChange } = child.props;
Expand Down
8 changes: 0 additions & 8 deletions test/ButtonGroupSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,6 @@ describe('ButtonGroup', () => {
.assertNone('.btn-group');
});

it('Should add toggle variation', () => {
mount(
<ButtonGroup toggle>
<Button>Title</Button>
</ButtonGroup>,
).assertSingle('.btn-group.btn-group-toggle');
});

it('Should have div as default component', () => {
mount(<ButtonGroup />).assertSingle('div');
});
Expand Down
1 change: 0 additions & 1 deletion tests/simple-types-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ const MegaComponent = () => (
as="div"
role="group"
size="lg"
toggle
vertical
bsPrefix="btn-group"
style={style}
Expand Down
2 changes: 1 addition & 1 deletion www/src/pages/components/buttons.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ The above handles styling, But requires manually controlling the


For a nicer experience with checked state management use the
`<ToggleButtonGroup>` instead of a `<ButtonGroup toggle>` component.
`<ToggleButtonGroup>` instead of a `<ButtonGroup>` component.
The group behaves as a form component, where the `value` is an array of the selected
`value`s for a named checkbox group or the single toggled
`value` in a similarly named radio group.
Expand Down
4 changes: 4 additions & 0 deletions www/src/pages/migrating.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ there may be a React-Bootstrap v3 targeting Bootstrap 6 depending on what's best

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

### ButtonGroup

- removed `toggle`.

### Form

- removed `inline`.
Expand Down

0 comments on commit 64b78a5

Please sign in to comment.