Skip to content

shadcn.io is an independent project built on shadcn/ui

Case Studies & Testimonials Navigation Menu for React

A Success Stories dropdown of four customer quotes from Vercel, Stripe, Airbnb, and Shopify, each with an avatar and five stars.

The bar shows Success Stories. The panel is headed CUSTOMER STORIES and shows four cards: Vercel, Stripe, Airbnb, and Shopify. Each has an avatar, five stars, a quote, and Read case study.

Put proof in the header when the quote should be seen before the customers page. A Card on that page can carry the full story. In React, Base UI closes the open panel when you press Escape.

Preview

Preview width

Installation

Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.
Use email insteadNo credit card

Anatomy

Navigation Menu anatomy: list, trigger, indicator, content, link

Usage

<div className="w-full max-w-md rounded-md border bg-background p-px">
  <NavigationMenu>
    <NavigationMenuList>
      <NavigationMenuItem>
        <NavigationMenuTrigger>Success Stories</NavigationMenuTrigger>
        <NavigationMenuContent>
          <div className="flex w-[700px] max-w-full flex-col gap-4 p-2">
            <h3 className="px-2 font-semibold text-muted-foreground text-sm">
              CUSTOMER STORIES
            </h3>
            <div className="grid grid-cols-2 gap-4">
              {testimonials.map((testimonial) => (
                <NavigationMenuLink
                  className="flex-col items-start gap-2"
                  key={testimonial.company}
                  render={<Link href={testimonial.href} />}
                >
                  <div className="flex items-center gap-2">
                    <Avatar size="sm">
                      <AvatarImage
                        alt={testimonial.company}
                        height={24}
                        src={testimonial.avatarSrc}
                        width={24}
                      />
                      <AvatarFallback>
                        {testimonial.avatarFallback}
                      </AvatarFallback>
                    </Avatar>
                    <span className="font-medium">{testimonial.company}</span>
                    <span className="flex gap-0.5">
{/* The rest of the file is under Installation. */}

FAQ

What is each card?

A whole NavigationMenuLink: an Avatar with the company's logo and initials as fallback, the name, five stars, the quote and Read case study with an arrow.

How is the rating announced?

The stars are hidden from assistive tech and a visually hidden Rated 5 out of 5 follows them. They are filled with the warning token so they follow the theme.

What happens on narrow screens?

The panel is w-[700px] with max-w-full, so it never grows past the screen, but its columns get tight. Below the md breakpoint, show the same links in a Sheet or a Drawer instead.

How do the links use my router?

Each link is your router's link rendered through NavigationMenuLink, so it keeps the menu's styles and focus handling. NavigationMenuLink takes the Next.js Link through render, as in render={<Link href="#" />}.

How does the menu work from the keyboard?

Tab moves between the triggers and the links, Enter or Space opens a trigger's panel, and Escape closes it and returns focus to the trigger. The root is a nav, so screen readers list it as a navigation landmark.

How do I mark the current page?

Set aria-current="page" on the NavigationMenuLink that matches the route, and style it with the aria-[current=page]: variant. active on NavigationMenuLink sets it for you.

API Reference

Navigation Menu

No extra props in this demo. The rest is on the Navigation Menu page.

Avatar

Sets size="sm", alt={testimonial.company}, height={24}, src={testimonial.avatarSrc} and width={24}. The rest is on the Avatar page.