Skip to content

docs(tabs): fix mistakes in nextjs and react-router examples #2405

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

Merged
merged 2 commits into from
Jun 1, 2025

Conversation

zhengjitf
Copy link
Contributor

@zhengjitf zhengjitf commented Feb 25, 2024

📝 Description

Fix mistakes in tabs examples with Next.js and React Router.

⛳️ Current behavior (updates)

Next.js example:

<Tabs aria-label="Options" selectedKey={pathname}>
      <Tab key="photos" title="Photos" href="/photos">
        <Card>
          <CardBody>
            Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
            incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
            exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
          </CardBody>
        </Card>
      </Tab>
...

Accroding to Next.js App router - usePathname#returns, key should be corresponding url path, that is, missing / in this example.

React Router example:

Prop id of <Tab/> doesn't work, but key does.

<Tabs selectedKey={pathname} aria-label="Tabs">
    <Tab id="/" href="/" title="Home" />
    <Tab id="/photos" href="/photos" title="Photos" />
    <Tab id="/music" href="/music" title="Music" />
    <Tab id="/videos" href="/videos" title="Videos" />
</Tabs>

💣 Is this a breaking change (Yes/No):

No

Summary by CodeRabbit

  • Refactor
    • Updated tab identifiers to align with their corresponding URL paths for improved consistency.

Copy link

changeset-bot bot commented Feb 25, 2024

⚠️ No Changeset found

Latest commit: 8a6e95f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

Copy link

vercel bot commented Feb 25, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
heroui ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 26, 2025 1:50pm
heroui-sb ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 26, 2025 1:50pm
nextui-storybook-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 26, 2025 1:50pm

Copy link

vercel bot commented Feb 25, 2024

@zhengjitf is attempting to deploy a commit to the NextUI Team on Vercel.

A member of the Team first needs to authorize it.

@zhengjitf zhengjitf changed the title fix(docs): mistakes in tabs examples docs(tabs): fix mistakes in nextjs and react-router examples Feb 27, 2024
@wingkwong wingkwong changed the base branch from main to canary April 28, 2024 14:54
@wingkwong wingkwong mentioned this pull request Nov 19, 2024
Copy link
Contributor

coderabbitai bot commented May 26, 2025

Walkthrough

The change updates the key prop values for each Tab component in the ExampleClientRouterWithTabs function, replacing the previous string identifiers with the corresponding href path values. No other logic, structure, or exported entity signatures are modified.

Changes

File Change Summary
apps/docs/content/docs/components/tabs.mdx Updated Tab component key props to use href values instead of string identifiers.

Sequence Diagram(s)

Not applicable.


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2cbc689 and 8a6e95f.

📒 Files selected for processing (1)
  • apps/docs/content/docs/components/tabs.mdx (3 hunks)
🔇 Additional comments (1)
apps/docs/content/docs/components/tabs.mdx (1)

127-127: Align Tab keys with URL paths
Great update—adding the leading slash to each <Tab key="…"> so the keys now exactly match their href values ensures that selectedKey={pathname} in Next.js will correctly highlight the active tab.

Also applies to: 136-136, 145-145


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@wingkwong wingkwong added this to the v2.7.9 milestone May 26, 2025
Copy link

pkg-pr-new bot commented May 26, 2025

Open in StackBlitz

@heroui/alert

npm i https://pkg.pr.new/@heroui/alert@2405

@heroui/accordion

npm i https://pkg.pr.new/@heroui/accordion@2405

@heroui/autocomplete

npm i https://pkg.pr.new/@heroui/autocomplete@2405

@heroui/avatar

npm i https://pkg.pr.new/@heroui/avatar@2405

@heroui/badge

npm i https://pkg.pr.new/@heroui/badge@2405

@heroui/breadcrumbs

npm i https://pkg.pr.new/@heroui/breadcrumbs@2405

@heroui/button

npm i https://pkg.pr.new/@heroui/button@2405

@heroui/calendar

npm i https://pkg.pr.new/@heroui/calendar@2405

@heroui/card

npm i https://pkg.pr.new/@heroui/card@2405

@heroui/checkbox

npm i https://pkg.pr.new/@heroui/checkbox@2405

@heroui/chip

npm i https://pkg.pr.new/@heroui/chip@2405

@heroui/code

npm i https://pkg.pr.new/@heroui/code@2405

@heroui/date-input

npm i https://pkg.pr.new/@heroui/date-input@2405

@heroui/date-picker

npm i https://pkg.pr.new/@heroui/date-picker@2405

@heroui/divider

npm i https://pkg.pr.new/@heroui/divider@2405

@heroui/drawer

npm i https://pkg.pr.new/@heroui/drawer@2405

@heroui/dropdown

npm i https://pkg.pr.new/@heroui/dropdown@2405

@heroui/form

npm i https://pkg.pr.new/@heroui/form@2405

@heroui/image

npm i https://pkg.pr.new/@heroui/image@2405

@heroui/input

npm i https://pkg.pr.new/@heroui/input@2405

@heroui/input-otp

npm i https://pkg.pr.new/@heroui/input-otp@2405

@heroui/kbd

npm i https://pkg.pr.new/@heroui/kbd@2405

@heroui/link

npm i https://pkg.pr.new/@heroui/link@2405

@heroui/listbox

npm i https://pkg.pr.new/@heroui/listbox@2405

@heroui/menu

npm i https://pkg.pr.new/@heroui/menu@2405

@heroui/modal

npm i https://pkg.pr.new/@heroui/modal@2405

@heroui/navbar

npm i https://pkg.pr.new/@heroui/navbar@2405

@heroui/number-input

npm i https://pkg.pr.new/@heroui/number-input@2405

@heroui/pagination

npm i https://pkg.pr.new/@heroui/pagination@2405

@heroui/progress

npm i https://pkg.pr.new/@heroui/progress@2405

@heroui/popover

npm i https://pkg.pr.new/@heroui/popover@2405

@heroui/radio

npm i https://pkg.pr.new/@heroui/radio@2405

@heroui/ripple

npm i https://pkg.pr.new/@heroui/ripple@2405

@heroui/scroll-shadow

npm i https://pkg.pr.new/@heroui/scroll-shadow@2405

@heroui/select

npm i https://pkg.pr.new/@heroui/select@2405

@heroui/skeleton

npm i https://pkg.pr.new/@heroui/skeleton@2405

@heroui/slider

npm i https://pkg.pr.new/@heroui/slider@2405

@heroui/snippet

npm i https://pkg.pr.new/@heroui/snippet@2405

@heroui/spacer

npm i https://pkg.pr.new/@heroui/spacer@2405

@heroui/spinner

npm i https://pkg.pr.new/@heroui/spinner@2405

@heroui/switch

npm i https://pkg.pr.new/@heroui/switch@2405

@heroui/tabs

npm i https://pkg.pr.new/@heroui/tabs@2405

@heroui/table

npm i https://pkg.pr.new/@heroui/table@2405

@heroui/toast

npm i https://pkg.pr.new/@heroui/toast@2405

@heroui/tooltip

npm i https://pkg.pr.new/@heroui/tooltip@2405

@heroui/user

npm i https://pkg.pr.new/@heroui/user@2405

@heroui/system

npm i https://pkg.pr.new/@heroui/system@2405

@heroui/react

npm i https://pkg.pr.new/@heroui/react@2405

@heroui/system-rsc

npm i https://pkg.pr.new/@heroui/system-rsc@2405

@heroui/theme

npm i https://pkg.pr.new/@heroui/theme@2405

@heroui/use-aria-accordion

npm i https://pkg.pr.new/@heroui/use-aria-accordion@2405

@heroui/use-aria-accordion-item

npm i https://pkg.pr.new/@heroui/use-aria-accordion-item@2405

@heroui/use-aria-button

npm i https://pkg.pr.new/@heroui/use-aria-button@2405

@heroui/use-aria-link

npm i https://pkg.pr.new/@heroui/use-aria-link@2405

@heroui/use-aria-modal-overlay

npm i https://pkg.pr.new/@heroui/use-aria-modal-overlay@2405

@heroui/use-aria-multiselect

npm i https://pkg.pr.new/@heroui/use-aria-multiselect@2405

@heroui/use-callback-ref

npm i https://pkg.pr.new/@heroui/use-callback-ref@2405

@heroui/use-clipboard

npm i https://pkg.pr.new/@heroui/use-clipboard@2405

@heroui/use-data-scroll-overflow

npm i https://pkg.pr.new/@heroui/use-data-scroll-overflow@2405

@heroui/use-disclosure

npm i https://pkg.pr.new/@heroui/use-disclosure@2405

@heroui/use-draggable

npm i https://pkg.pr.new/@heroui/use-draggable@2405

@heroui/use-image

npm i https://pkg.pr.new/@heroui/use-image@2405

@heroui/use-infinite-scroll

npm i https://pkg.pr.new/@heroui/use-infinite-scroll@2405

@heroui/use-intersection-observer

npm i https://pkg.pr.new/@heroui/use-intersection-observer@2405

@heroui/use-is-mobile

npm i https://pkg.pr.new/@heroui/use-is-mobile@2405

@heroui/use-is-mounted

npm i https://pkg.pr.new/@heroui/use-is-mounted@2405

@heroui/use-measure

npm i https://pkg.pr.new/@heroui/use-measure@2405

@heroui/use-pagination

npm i https://pkg.pr.new/@heroui/use-pagination@2405

@heroui/use-ref-state

npm i https://pkg.pr.new/@heroui/use-ref-state@2405

@heroui/use-real-shape

npm i https://pkg.pr.new/@heroui/use-real-shape@2405

@heroui/use-resize

npm i https://pkg.pr.new/@heroui/use-resize@2405

@heroui/use-safe-layout-effect

npm i https://pkg.pr.new/@heroui/use-safe-layout-effect@2405

@heroui/use-scroll-position

npm i https://pkg.pr.new/@heroui/use-scroll-position@2405

@heroui/use-ssr

npm i https://pkg.pr.new/@heroui/use-ssr@2405

@heroui/use-update-effect

npm i https://pkg.pr.new/@heroui/use-update-effect@2405

@heroui/use-theme

npm i https://pkg.pr.new/@heroui/use-theme@2405

@heroui/aria-utils

npm i https://pkg.pr.new/@heroui/aria-utils@2405

@heroui/dom-animation

npm i https://pkg.pr.new/@heroui/dom-animation@2405

@heroui/framer-utils

npm i https://pkg.pr.new/@heroui/framer-utils@2405

@heroui/react-rsc-utils

npm i https://pkg.pr.new/@heroui/react-rsc-utils@2405

@heroui/react-utils

npm i https://pkg.pr.new/@heroui/react-utils@2405

@heroui/shared-icons

npm i https://pkg.pr.new/@heroui/shared-icons@2405

@heroui/shared-utils

npm i https://pkg.pr.new/@heroui/shared-utils@2405

@heroui/stories-utils

npm i https://pkg.pr.new/@heroui/stories-utils@2405

@heroui/test-utils

npm i https://pkg.pr.new/@heroui/test-utils@2405

commit: 8a6e95f

@jrgarciadev jrgarciadev merged commit 9433bff into heroui-inc:canary Jun 1, 2025
10 checks passed
jrgarciadev added a commit that referenced this pull request Jun 1, 2025
* fix(date-picker): error state (#5317)

* fix(date-range-picker): fixed the error state in preset

* Update giant-sloths-shop.md

* Removed if statement

* chore(date-picker): prettier

---------

Co-authored-by: WK Wong <[email protected]>

* fix(theme): clear button in mobile (#5252)

* fix(toast): fixed close button hover position

* fix(input): fixed the clear button rendering on smaller devices

* Delete .changeset/soft-spoons-march.md

* Update input.ts

* Undo unrelated toast changes

* fix(toast): icons (#5246)

* feat(shared-icons): add loading icon

* fix(toast): icons

* chore(toast): revise types for icons

* chore(changeset): add changeset

* refactor: migrate eslint to v9 (#5267)

* refactor: migrate eslint to v9

* chore: lint

* chore: update eslint command

* chore: fix lint warnings

* chore: separate lint and lint:fix

* chore: exclude contentlayer generated code

* fix(scripts): add missing await

* fix(autocomplete): persist last selected item position (#5286)

* refactor(select): remove unnecessary code

* fix(autocomplete): persist last selected item position

* chore(changeset): add changeset

* chore(deps): bump framer-motion version (#5287)

* chore(deps): bump framer-motion version

* fix: typing issues

* chore(changeset): add changeset

---------

Co-authored-by: Junior Garcia <[email protected]>

* chore(docs): supplement onAction & selectionBehavior (#5289)

* fix(autocomplete): ensure focused item matches selected item after filter, selection (#5290)

* fix(autocomplete): ensure focused item matches selected item after filter, selection

* chore: apply type and default value

* chore: add perpose coment in updated code

* test: add focuskey management testcode

* docs: add changeset

* docs: update changeset

* chore: remove comment

* fix: broken components in stories (#5291)

* chore(switch): remove xl size

* chore(docs): remove xl size

* chore(system-rsc): remove xl size

* chore(circular-progress): remove xl size

* chore: undo

* chore(deps): bump RA versions (#5310)

* chore(deps): ra version bump

* chore(changeset): add changeset

* fix(scripts): incorrect docs path

---------

Co-authored-by: Junior Garcia <[email protected]>

* chore(docs): update meta data (#5311)

* docs(layout.tsx): added text-foreground (#5316)

* feat(tabs): add click handling for tab items in tests and implementation (#3917)

Co-authored-by: WK Wong <[email protected]>

* fix issues in tabs examples (#2405)

Co-authored-by: WK Wong <[email protected]>

* chore(docs): add missing onValueChange in CheckboxGroup (#5332)

* ci(changesets): version packages (#5323)

Co-authored-by: Junior Garcia <[email protected]>

---------

Co-authored-by: Vishv Salvi <[email protected]>
Co-authored-by: WK Wong <[email protected]>
Co-authored-by: KumJungMin <[email protected]>
Co-authored-by: liaoyinglong <[email protected]>
Co-authored-by: zhengjitf <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
wingkwong added a commit that referenced this pull request Jun 2, 2025
* chore: add herohack announcement

* fix(date-picker): error state (#5317)

* fix(date-range-picker): fixed the error state in preset

* Update giant-sloths-shop.md

* Removed if statement

* chore(date-picker): prettier

---------

Co-authored-by: WK Wong <[email protected]>

* chore: banner replacement

* fix(theme): clear button in mobile (#5252)

* fix(toast): fixed close button hover position

* fix(input): fixed the clear button rendering on smaller devices

* Delete .changeset/soft-spoons-march.md

* Update input.ts

* Undo unrelated toast changes

* fix(toast): icons (#5246)

* feat(shared-icons): add loading icon

* fix(toast): icons

* chore(toast): revise types for icons

* chore(changeset): add changeset

* refactor: migrate eslint to v9 (#5267)

* refactor: migrate eslint to v9

* chore: lint

* chore: update eslint command

* chore: fix lint warnings

* chore: separate lint and lint:fix

* chore: exclude contentlayer generated code

* fix(scripts): add missing await

* fix(autocomplete): persist last selected item position (#5286)

* refactor(select): remove unnecessary code

* fix(autocomplete): persist last selected item position

* chore(changeset): add changeset

* chore(deps): bump framer-motion version (#5287)

* chore(deps): bump framer-motion version

* fix: typing issues

* chore(changeset): add changeset

---------

Co-authored-by: Junior Garcia <[email protected]>

* chore(docs): supplement onAction & selectionBehavior (#5289)

* fix(autocomplete): ensure focused item matches selected item after filter, selection (#5290)

* fix(autocomplete): ensure focused item matches selected item after filter, selection

* chore: apply type and default value

* chore: add perpose coment in updated code

* test: add focuskey management testcode

* docs: add changeset

* docs: update changeset

* chore: remove comment

* fix: broken components in stories (#5291)

* chore(switch): remove xl size

* chore(docs): remove xl size

* chore(system-rsc): remove xl size

* chore(circular-progress): remove xl size

* chore: undo

* chore(deps): bump RA versions (#5310)

* chore(deps): ra version bump

* chore(changeset): add changeset

* fix(scripts): incorrect docs path

---------

Co-authored-by: Junior Garcia <[email protected]>

* chore(docs): update meta data (#5311)

* docs(layout.tsx): added text-foreground (#5316)

* feat(tabs): add click handling for tab items in tests and implementation (#3917)

Co-authored-by: WK Wong <[email protected]>

* fix issues in tabs examples (#2405)

Co-authored-by: WK Wong <[email protected]>

* chore(docs): add missing onValueChange in CheckboxGroup (#5332)

* ci(changesets): version packages (#5323)

Co-authored-by: Junior Garcia <[email protected]>

* chore: remove pre.json

---------

Co-authored-by: Junior Garcia <[email protected]>
Co-authored-by: Vishv Salvi <[email protected]>
Co-authored-by: KumJungMin <[email protected]>
Co-authored-by: liaoyinglong <[email protected]>
Co-authored-by: zhengjitf <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants