Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Add soft deperecation notice for the ButtonGroup component #65429

Merged
merged 5 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/components/src/button-group/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# ButtonGroup

This component is deprecated, instead use `ToggleGroupControl` component.
hbhalodia marked this conversation as resolved.
Show resolved Hide resolved
ButtonGroup can be used to group any related buttons together. To emphasize related buttons, a group should share a common container.

![ButtonGroup component](https://wordpress.org/gutenberg/files/2018/12/s_96EC471FE9C9D91A996770229947AAB54A03351BDE98F444FD3C1BF0CED365EA_1541792995815_ButtonGroup.png)
Expand Down
11 changes: 11 additions & 0 deletions packages/components/src/button-group/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import type { ForwardedRef } from 'react';
* WordPress dependencies
*/
import { forwardRef } from '@wordpress/element';
import deprecated from '@wordpress/deprecated';

/**
* Internal dependencies
Expand All @@ -22,6 +23,14 @@ function UnforwardedButtonGroup(
const { className, ...restProps } = props;
const classes = clsx( 'components-button-group', className );

/**
* Add deprecation notice for `ButtonGroup` component.
*/
hbhalodia marked this conversation as resolved.
Show resolved Hide resolved
deprecated( 'wp.components.ButtonGroup', {
since: '6.7',
hbhalodia marked this conversation as resolved.
Show resolved Hide resolved
alternative: 'wp.components.ToggleGroupControl',
} );

return (
<div ref={ ref } role="group" className={ classes } { ...restProps } />
);
Expand All @@ -31,6 +40,8 @@ function UnforwardedButtonGroup(
* ButtonGroup can be used to group any related buttons together. To emphasize
* related buttons, a group should share a common container.
*
* @deprecated use `ToggleGroupControl` instead.
hbhalodia marked this conversation as resolved.
Show resolved Hide resolved
*
* ```jsx
* import { Button, ButtonGroup } from '@wordpress/components';
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import ButtonGroup from '..';
import Button from '../../button';

hbhalodia marked this conversation as resolved.
Show resolved Hide resolved
const meta: Meta< typeof ButtonGroup > = {
title: 'Components/ButtonGroup',
title: 'Components (Deprecated)/ButtonGroup',
id: 'components-buttongroup',
component: ButtonGroup,
argTypes: {
children: { control: { type: null } },
Expand Down
Loading