Skip to content

IconButton: add hasTriangleDownIcon prop for dropdown affordance#8067

Draft
dylanatsmith wants to merge 1 commit into
mainfrom
dats/silver-bassoon
Draft

IconButton: add hasTriangleDownIcon prop for dropdown affordance#8067
dylanatsmith wants to merge 1 commit into
mainfrom
dats/silver-bassoon

Conversation

@dylanatsmith

Copy link
Copy Markdown
Member

Closes #

Adds a first-class prop to IconButton so an icon-only button can show a TriangleDownIcon caret indicating it opens a dropdown/menu. Today IconButton renders a single, square icon — ButtonBase short-circuits to render only the icon and ignores trailingAction/children — so there was no sanctioned way to add a caret. This introduces one deliberately rather than composing two glyphs into a custom icon.

Note

hasTriangleDownIcon is a working prop name to be discussed with Primer design before stabilising. By design, the only available trailing glyph is TriangleDownIcon. This PR is a draft to support that conversation.

Changelog

New

  • IconButton now accepts hasTriangleDownIcon?: boolean. When true, a TriangleDownIcon is rendered after the icon.

Changed

  • When hasTriangleDownIcon is set, the IconButton switches from a fixed square to an auto-width layout (token-based gap and padding-inline per size). A data-has-triangle-down-icon attribute on the button drives the styling; the caret carries data-component="triangleDownIcon".

Removed

  • N/A

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; if selected, include a brief description as to why

Testing & Reviewing

  • New unit tests cover that the caret renders only when hasTriangleDownIcon is set and that data-has-triangle-down-icon is applied accordingly.
  • New IconButton/Dev story WithTriangleDownIcon demonstrates the three sizes and the primary/invisible variants.
  • Open consideration for review: whether the prop should also wire aria-haspopup/aria-expanded automatically, or leave that to the consumer (as ActionMenu does today).

Merge checklist

  • Added/updated tests
  • Added/updated documentation
  • Added/updated previews (Storybook)
  • Changes are SSR compatible
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
  • Tested in Edge
  • (GitHub staff only) Integration tests pass at github/github-ui

Adds a working `hasTriangleDownIcon` boolean prop to IconButton that renders
a TriangleDownIcon after the icon to indicate the button opens a dropdown or
menu. The control switches from a fixed square to an auto-width layout with
token-based gap and padding per size. The only available trailing glyph is
TriangleDownIcon.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@changeset-bot

changeset-bot Bot commented Jun 26, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 956e893

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/react Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions Bot added the staff Author is a staff member label Jun 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Action required

👋 Hi, this pull request contains changes to the source code that github/github-ui depends on. If you are GitHub staff, test these changes with github/github-ui using the integration workflow. If this doesn't work, you can also use the original workflow here. Check the integration testing docs for step-by-step instructions. Or, apply the integration-tests: skipped manually label to skip these checks.

To publish a canary release for integration testing, apply the Canary Release label to this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm staff Author is a staff member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant