Skip to content

Conversation

KavanBhavsar35
Copy link
Contributor

@KavanBhavsar35 KavanBhavsar35 commented May 12, 2025

Add Breadcrumb component and related documentation/examples

Summary by CodeRabbit

  • New Features
    • Introduced a new Breadcrumb navigation component with accessible subcomponents for building breadcrumb trails.
    • Added customizable separators, collapsed breadcrumb style, and support for custom link components.
    • Provided multiple example breadcrumb styles: default, custom separator, collapsed, and custom link integration.
  • Documentation
    • Added comprehensive documentation for the Breadcrumb component with installation instructions and usage examples.
  • Chores
    • Updated navigation and component configuration to include the new Breadcrumb component.
    • Added a new dependency to support component functionality.

Copy link

vercel bot commented May 12, 2025

@KavanBhavsar35 is attempting to deploy a commit to the Retro UI Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

coderabbitai bot commented May 12, 2025

Walkthrough

A new Breadcrumb navigation component suite was introduced, including its core implementation, documentation, navigation entry, and preview examples. The Breadcrumb component and its subcomponents are now exported and registered in the project configuration, with corresponding documentation and example usages. A new dependency, @radix-ui/react-slot, was also added.

Changes

File(s) Change Summary
components/retroui/Breadcrumb.tsx Introduced a compound Breadcrumb component with subcomponents for accessible breadcrumb navigation.
components/retroui/index.ts Exported the new Breadcrumb component for public usage.
config/components.ts Registered Breadcrumb as a core component and added four breadcrumb example entries for previews.
config/navigation.ts Added Breadcrumb entry to the components section of the side navigation configuration.
content/docs/components/breadcrumb.mdx Added documentation for Breadcrumb, including installation instructions and multiple usage examples.
package.json Added @radix-ui/react-slot dependency.
preview/components/breadcrumb-style-default.tsx Added a default style Breadcrumb preview component.
preview/components/breadcrumb-custom-separator.tsx Added a Breadcrumb preview using a custom separator icon.
preview/components/breadcrumb-style-collapsed.tsx Added a Breadcrumb preview with collapsed (ellipsis) style.
preview/components/breadcrumb-link-component.tsx Added a Breadcrumb preview using custom link components (e.g., Next.js Link).

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant Breadcrumb
  participant Breadcrumb.List
  participant Breadcrumb.Item
  participant Breadcrumb.Link
  participant Breadcrumb.Separator
  participant Breadcrumb.Page
  participant Breadcrumb.Ellipsis

  User->>Breadcrumb: Render BreadcrumbRoot (nav)
  Breadcrumb->>Breadcrumb.List: Render List (ol)
  loop For each breadcrumb item
    Breadcrumb.List->>Breadcrumb.Item: Render Item (li)
    alt Is link
      Breadcrumb.Item->>Breadcrumb.Link: Render Link (a or custom)
    else Is ellipsis
      Breadcrumb.Item->>Breadcrumb.Ellipsis: Render Ellipsis
    else Is current page
      Breadcrumb.Item->>Breadcrumb.Page: Render Page (span)
    end
    opt Not last item
      Breadcrumb.List->>Breadcrumb.Separator: Render Separator (icon/custom)
    end
  end
Loading

Poem

🥕
A breadcrumb trail, a path so neat,
With links and dots beneath your feet.
Custom icons, collapsed with style,
Each example sure to make you smile.
Now hop along, explore, and see—
Navigation’s clear as it can be!
🐇

Tip

⚡️ Faster reviews with caching
  • CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.

Enjoy the performance boost—your workflow just got faster.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4538d4e and a61ee86.

📒 Files selected for processing (2)
  • components/retroui/Breadcrumb.tsx (1 hunks)
  • content/docs/components/breadcrumb.mdx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • content/docs/components/breadcrumb.mdx
  • components/retroui/Breadcrumb.tsx
✨ Finishing Touches
  • 📝 Generate Docstrings

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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (3)
config/components.ts (1)

111-114: Consider adding missing dependencies

The breadcrumb component likely uses @radix-ui/react-slot for the asChild prop functionality, but this dependency isn't listed in the component configuration.

 breadcrumb: {
   name: "breadcrumb",
+  dependencies: ["@radix-ui/react-slot"],
   filePath: "components/retroui/Breadcrumb.tsx",
 }
components/retroui/Breadcrumb.tsx (2)

6-11: Use a more specific ref type for <nav>.
Instead of HTMLElement, consider HTMLNavElement to improve type safety.

-React.forwardRef<HTMLElement,
+React.forwardRef<HTMLNavElement,

21-33: Consider removing default list markers.
By default <ol> renders numbers; since you’re using flex layout for breadcrumbs, you might want to suppress native markers with Tailwind’s list-none class. Example:

- className={cn(
-   "flex flex-wrap items-center gap-1.5 sm:gap-2.5 text-muted-foreground",
+ className={cn(
+   "flex flex-wrap items-center gap-1.5 sm:gap-2.5 text-muted-foreground list-none",
    className
  )}

This ensures no unexpected numbering appears.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 74e0d8b and 4538d4e.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (10)
  • components/retroui/Breadcrumb.tsx (1 hunks)
  • components/retroui/index.ts (1 hunks)
  • config/components.ts (2 hunks)
  • config/navigation.ts (1 hunks)
  • content/docs/components/breadcrumb.mdx (1 hunks)
  • package.json (1 hunks)
  • preview/components/breadcrumb-custom-separator.tsx (1 hunks)
  • preview/components/breadcrumb-link-component.tsx (1 hunks)
  • preview/components/breadcrumb-style-collapsed.tsx (1 hunks)
  • preview/components/breadcrumb-style-default.tsx (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
components/retroui/Breadcrumb.tsx (1)
lib/utils.ts (1)
  • cn (4-6)
🔇 Additional comments (17)
package.json (1)

25-25: Approve addition of Radix UI slot dependency.
The new @radix-ui/react-slot dependency at version ^1.2.2 is correctly specified and necessary for the compound Breadcrumb implementation.

config/navigation.ts (1)

31-31: Approve navigation entry for Breadcrumb component.
The new sidebar entry { title: "Breadcrumb", href: \${componentsRoute}/breadcrumb` }` follows the existing structure and alphabetical ordering, enabling users to access the Breadcrumb docs.

components/retroui/index.ts (1)

25-25: Approve export of Breadcrumb component.
Re-exporting ./Breadcrumb integrates the new component into the public API, making it available alongside the other UI modules.

preview/components/breadcrumb-style-default.tsx (1)

1-22: Approve default breadcrumb example.
BreadcrumbStyleDefault properly imports and composes the Breadcrumb API—using <Breadcrumb.List>, <Breadcrumb.Item>, <Breadcrumb.Link>, <Breadcrumb.Separator>, and <Breadcrumb.Page>—to illustrate a basic, accessible breadcrumb.

preview/components/breadcrumb-custom-separator.tsx (1)

1-27: Approve custom-separator breadcrumb example.
BreadcrumbCustomSeparator correctly demonstrates overriding the default separator by rendering a <Slash /> icon inside <Breadcrumb.Separator>, showcasing the component’s flexibility.

preview/components/breadcrumb-style-collapsed.tsx (1)

1-30: Implementation looks good!

This component properly implements a collapsed breadcrumb pattern with an ellipsis to indicate hidden intermediate breadcrumb items. The code correctly uses the Breadcrumb compound component, including proper usage of Next.js Link integration with the asChild prop.

preview/components/breadcrumb-link-component.tsx (1)

1-27: LGTM - Good implementation of link component example

This example correctly demonstrates how to integrate Next.js Link components with the Breadcrumb component using the asChild prop, providing a clean and accessible navigation pattern.

content/docs/components/breadcrumb.mdx (2)

1-5: Verify the last updated date

The last updated date shows May 12, 2025, which is a future date. Consider updating it to the actual current date.


6-68: Documentation structure looks good

The documentation is well-structured with a clear component showcase, installation instructions, and multiple examples demonstrating different breadcrumb variants.

config/components.ts (2)

111-114: Component registration looks good!

The breadcrumb component is properly registered in the core components configuration.


476-503: Example registrations look good!

All four breadcrumb example components are properly registered with appropriate file paths and lazy-loaded imports.

components/retroui/Breadcrumb.tsx (6)

1-4: Imports look good.
The component correctly pulls in React, the Slot utility, icons from lucide-react, and the cn helper from @/lib/utils. It aligns with the new dependency added (@radix-ui/react-slot).


36-43: BreadcrumbItem is straightforward and correct.
The inline-flex styling and ref forwarding are appropriate for each <li> in the breadcrumb.


44-61: BreadcrumbLink implementation is solid.
Leveraging Radix’s Slot for asChild support, plus the focus/hover styles, gives good flexibility and accessibility.


77-91: BreadcrumbSeparator is well implemented.
Using role="presentation" and aria-hidden="true" on the <li> makes the separator decorative, which is correct.


109-117: Composite assignment is correct.
Using Object.assign to bundle all subcomponents onto Breadcrumb is a common and effective pattern.


118-118: Export statement is straightforward.
Named export of Breadcrumb aligns with the rest of the codebase.

Comment on lines 93 to 106
const BreadcrumbEllipsis = ({
className,
...props
}: React.ComponentProps<"span">) => (
<span
role="presentation"
aria-hidden="true"
className={cn("flex h-9 w-9 items-center justify-center", className)}
{...props}
>
<MoreHorizontal className="h-4 w-4" />
<span className="sr-only">More</span>
</span>
)
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix aria-hidden placement in the ellipsis.
By marking the outer <span> as aria-hidden, you hide the screen-reader-only text too. Instead, move aria-hidden to the icon itself so the “More” text remains accessible:

-<span
-  role="presentation"
-  aria-hidden="true"
+<span
+  role="presentation"
   className={cn("flex h-9 w-9 items-center justify-center", className)}
   {...props}
 >
-  <MoreHorizontal className="h-4 w-4" />
+  <MoreHorizontal aria-hidden="true" className="h-4 w-4" />
   <span className="sr-only">More</span>
 </span>

This ensures screen readers announce “More” for the collapsed breadcrumb indicator.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const BreadcrumbEllipsis = ({
className,
...props
}: React.ComponentProps<"span">) => (
<span
role="presentation"
aria-hidden="true"
className={cn("flex h-9 w-9 items-center justify-center", className)}
{...props}
>
<MoreHorizontal className="h-4 w-4" />
<span className="sr-only">More</span>
</span>
)
const BreadcrumbEllipsis = ({
className,
...props
}: React.ComponentProps<"span">) => (
<span
role="presentation"
className={cn("flex h-9 w-9 items-center justify-center", className)}
{...props}
>
<MoreHorizontal aria-hidden="true" className="h-4 w-4" />
<span className="sr-only">More</span>
</span>
)

@ariflogs
Copy link
Member

thank you for the contribution 🙏

@ariflogs ariflogs merged commit af49d1b into Logging-Stuff:main May 13, 2025
1 of 2 checks passed
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.

2 participants