Skip to content

feat(ActionButton): use button component for action button#1358

Open
ethanashaw wants to merge 5 commits into
mainfrom
use-button-for-action-button
Open

feat(ActionButton): use button component for action button#1358
ethanashaw wants to merge 5 commits into
mainfrom
use-button-for-action-button

Conversation

@ethanashaw
Copy link
Copy Markdown
Contributor

Done

I changed ActionButton to use the Button component instead of the default HTML button, allowing for the extra props.

I made a change to one of the ConfirmationModal stories showing this off. We needed to include an icon for a confirmation button, but the button couldn't be styled with the hasIcon prop before.

QA

Pinging @canonical/react-library-maintainers for a review.

Storybook

To see rendered examples of all react-components, run:

yarn start

QA in your project

from react-components run:

yarn build
npm pack

Install the resulting tarball in your project with:

yarn add <path-to-tarball>

QA steps

  • Steps for QA.

Percy steps

  • No visual changes expected.

Co-authored-by: Copilot <copilot@github.com>
Copilot AI review requested due to automatic review settings April 24, 2026 23:40
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates ActionButton to render the shared Button component so it can accept additional Button props (e.g. hasIcon), and demonstrates this in Storybook via ConfirmationModal.

Changes:

  • Switch ActionButton from a native <button> to the shared <Button> component and widen its spread props to ButtonProps.
  • Attempt to add ref support to Button via a ref prop.
  • Update ConfirmationModal Storybook story to show an icon + label confirm button using hasIcon.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
src/components/ActionButton/ActionButton.tsx Renders Button instead of native button and expands accepted props to ButtonProps.
src/components/Button/Button.tsx Adds a ref field to the exported prop type in an attempt to support refs.
src/components/ConfirmationModal/ConfirmationModal.stories.tsx Demonstrates icon+label confirm button using confirmButtonProps.hasIcon.
Comments suppressed due to low confidence (1)

src/components/ActionButton/ActionButton.tsx:180

  • ActionButton relies on ref.current to measure the button size, but passing ref={ref} to <Button /> will not attach the ref unless Button forwards refs. As-is, ref.current will stay null and the loader sizing logic won’t run. Either switch Button to forwardRef (preferred) or revert this component to rendering a native <button> and manually apply the needed Button classes/props.
    <Button
      className={buttonClasses}
      ref={ref}
      onClick={isDisabled ? onClickDisabled : onClick}
      aria-disabled={isDisabled || undefined}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/components/Button/Button.tsx
Comment thread src/components/ActionButton/ActionButton.tsx Outdated
Comment thread src/components/ActionButton/ActionButton.tsx Outdated
Comment thread src/components/ConfirmationModal/ConfirmationModal.stories.tsx Outdated
ethanashaw and others added 4 commits April 27, 2026 17:07
Co-authored-by: Copilot <copilot@github.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/components/Button/Button.tsx
Comment thread src/components/ActionButton/ActionButton.tsx
Comment thread src/components/Modal/Modal.stories.tsx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants