Skip to content

TreeView: add as prop to TreeView.Item#7897

Draft
liuliu-dev wants to merge 5 commits into
mainfrom
liuliu/add-as-to-treeview-item
Draft

TreeView: add as prop to TreeView.Item#7897
liuliu-dev wants to merge 5 commits into
mainfrom
liuliu/add-as-to-treeview-item

Conversation

@liuliu-dev
Copy link
Copy Markdown
Contributor

Closes https://github.com/github/primer/issues/6495 and closes https://github.com/github/core-ux/issues/2495

Adds support for the as prop on TreeView.Item, enabling consumers to render the tree item as a different element (e.g. a native <a> or a custom router-link component) while preserving all existing keyboard, focus, and ARIA behavior. This brings TreeView.Item in line with other polymorphic Primer components such as Breadcrumbs.Item and ActionList.LinkItem.

// Native anchor
<TreeView.Item id="overview" as="a" href="/overview">Overview</TreeView.Item>

// Custom router link
<TreeView.Item id="docs" as={RouterLink} to="/docs">Docs</TreeView.Item>

Changelog

New

Changed

Removed

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

Merge checklist

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 28, 2026

🦋 Changeset detected

Latest commit: 81d647b

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 integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label May 28, 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. 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.

@github-actions github-actions Bot requested a deployment to storybook-preview-7897 May 28, 2026 21:24 Abandoned
@github-actions github-actions Bot temporarily deployed to storybook-preview-7897 May 28, 2026 21:37 Inactive
@liuliu-dev liuliu-dev added the Canary Release Apply this label when you want CI to create a canary release of the current PR label May 28, 2026
@github-actions github-actions Bot temporarily deployed to storybook-preview-7897 May 28, 2026 21:46 Inactive
@primer-integration
Copy link
Copy Markdown

👋 Hi from github/github-ui! Your integration PR is ready: https://github.com/github/github-ui/pull/21835

@primer-integration
Copy link
Copy Markdown

Integration test results from github/github-ui:

Passed  CI   Passed
Passed  VRT   Passed
Passed  Projects   Passed

All checks passed!

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

Labels

Canary Release Apply this label when you want CI to create a canary release of the current PR integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant