From 6aecf2ece6b5ea46004045e0126690cee1e96b8b Mon Sep 17 00:00:00 2001 From: Eric Olkowski Date: Thu, 23 Oct 2025 09:17:10 -0400 Subject: [PATCH 1/7] feat(Button): added circle variant --- .../src/components/Button/Button.tsx | 4 ++ .../src/components/Button/examples/Button.md | 8 +++ .../Button/examples/ButtonCircle.tsx | 62 +++++++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 packages/react-core/src/components/Button/examples/ButtonCircle.tsx diff --git a/packages/react-core/src/components/Button/Button.tsx b/packages/react-core/src/components/Button/Button.tsx index dbd8c50c6bb..39b697cd785 100644 --- a/packages/react-core/src/components/Button/Button.tsx +++ b/packages/react-core/src/components/Button/Button.tsx @@ -107,6 +107,8 @@ export interface ButtonProps extends Omit, 'r isHamburger?: boolean; /** Adjusts and animates the hamburger icon to indicate what will happen upon clicking the button. */ hamburgerVariant?: 'expand' | 'collapse'; + /** Flag indicating the button is a circle button. Intended for buttons that only contain an icon.. */ + isCircle?: boolean; /** @hide Forwarded ref */ innerRef?: React.Ref; /** Adds count number to button */ @@ -131,6 +133,7 @@ const ButtonBase: React.FunctionComponent = ({ isSettings, isHamburger, hamburgerVariant, + isCircle, spinnerAriaValueText, spinnerAriaLabelledBy, spinnerAriaLabel, @@ -261,6 +264,7 @@ const ButtonBase: React.FunctionComponent = ({ variant === ButtonVariant.stateful && styles.modifiers[state], size === ButtonSize.sm && styles.modifiers.small, size === ButtonSize.lg && styles.modifiers.displayLg, + isCircle && 'pf-m-circle', className )} disabled={isButtonElement ? isDisabled : null} diff --git a/packages/react-core/src/components/Button/examples/Button.md b/packages/react-core/src/components/Button/examples/Button.md index 7b5f667a4e6..e0ae6ca1c20 100644 --- a/packages/react-core/src/components/Button/examples/Button.md +++ b/packages/react-core/src/components/Button/examples/Button.md @@ -138,6 +138,14 @@ Stateful buttons are ideal for displaying the state of notifications. Use `varia ``` +### Circle buttons + +Pass `isCircle` to a button to modify its styling from simply rounded corners to complete circles. Circle buttons are intended for buttons that only contain an icon and adequate accessible naming. + +```ts file="./ButtonCircle.tsx" + +``` + ## Animated examples The following `); + expect(screen.getByRole('button')).toHaveClass('pf-m-circle'); +}); + test(`Renders custom icon with class ${styles.modifiers.inProgress} when isLoading = true and icon is present`, () => { render( ); - expect(screen.getByRole('button')).toHaveClass('pf-m-circle'); + expect(screen.getByRole('button')).toHaveClass(styles.modifiers.circle); }); test(`Renders custom icon with class ${styles.modifiers.inProgress} when isLoading = true and icon is present`, () => { diff --git a/packages/react-core/src/components/MenuToggle/MenuToggle.tsx b/packages/react-core/src/components/MenuToggle/MenuToggle.tsx index 5ad3ba88f5e..a707417af8a 100644 --- a/packages/react-core/src/components/MenuToggle/MenuToggle.tsx +++ b/packages/react-core/src/components/MenuToggle/MenuToggle.tsx @@ -229,7 +229,7 @@ class MenuToggleBase extends Component { return (