nextui icon indicating copy to clipboard operation
nextui copied to clipboard

feat: tag

Open tianenpang opened this issue 1 month ago โ€ข 7 comments

Closes #

๐Ÿ“ Description

This PR introduces TagGroup and Tag components for managing tag collections with selection and removal, and ErrorMessage component for validation error messages. Both follow React Aria Components patterns and integrate with HeroUI's design system.

โ›ณ๏ธ Current behavior (updates)

N/A

๐Ÿš€ New behavior

TagGroup & Tag

  • Composable API: TagGroup, TagGroup.List, Tag, Tag.RemoveButton
  • Features:
    • Selection modes: none, single, multiple (controlled/uncontrolled)
    • Keyboard navigation (Arrow keys, Delete/Backspace)
    • Remove button via Tag.RemoveButton
    • Disabled states (group and individual)
    • On-surface variant support
    • Size variants (sm, md, lg) with group-level inheritance
    • Render props support
  • Accessibility: Full ARIA support via React Aria TagGroup primitive
  • Styling: BEM-based CSS with interactive states
  • Documentation: 10 demos (basic, sizes, disabled, selection modes, controlled, on-surface, error message, prefix, remove button, list data)

ErrorMessage

  • Simple API: Standalone component for validation errors
  • Features:
    • Automatic slot="errorMessage" integration
    • Danger color styling with truncation
    • Smooth transitions
  • Documentation: 2 demos (basic, TagGroup integration)

New Components:

  • TagGroup, TagGroup.List, Tag, Tag.RemoveButton, ErrorMessage

Additional Changes:

  • Enhanced composeTwRenderProps utility for render-props support
  • Added useListData hook for list data management
  • Fixed Storybook link generation for grouped titles

๐Ÿ’ฃ Is this a breaking change (Yes/No):

No

๐Ÿ“ Additional Information

  • useListData Hook: Added for immutable list data management (item operations, selection, filtering). Based on Adobe React Spectrum's @react-stately/data (copied to avoid bundle size increase). Licensed under Apache License 2.0.

  • Storybook Links Fix: Updated convertStorybookTitleToPath to handle grouped Storybook titles (e.g., Components/Collections/TagGroup).

  • Full TypeScript support and Storybook stories included.

tianenpang avatar Dec 07 '25 17:12 tianenpang

โš ๏ธ No Changeset found

Latest commit: 4f00f57d61d8bf9cf5217621bfb9cdf8af4e4c08

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

changeset-bot[bot] avatar Dec 07 '25 17:12 changeset-bot[bot]

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
heroui Ready Ready Preview, Comment Dec 14, 2025 6:51pm
heroui-sb Ready Ready Preview, Comment Dec 14, 2025 6:51pm

vercel[bot] avatar Dec 07 '25 17:12 vercel[bot]

[!IMPORTANT]

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

โœจ Finishing touches
๐Ÿงช Generate unit tests (beta)
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment
  • [ ] Commit unit tests in branch feat/v3-tag

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

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Dec 07 '25 17:12 coderabbitai[bot]

Open in StackBlitz

npm i https://pkg.pr.new/heroui-inc/heroui/@heroui/react@5971
npm i https://pkg.pr.new/heroui-inc/heroui/@heroui/styles@5971

commit: 4f00f57

pkg-pr-new[bot] avatar Dec 07 '25 20:12 pkg-pr-new[bot]