Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Card Grid Mega Menu Navbar Block for React

A one-bar navbar for a design-system suite whose Products menu opens a 3 by 2 grid of cells and whose Solutions menu opens a 2 by 3 grid of industries, cells sharing hairlines, with accordion groups in a sheet on phones.

Framework
UI library

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

A grid-menu navbar for React with Base UI. The wordmark leads; Products opens a 3 by 2 grid of six cells, each an icon on a tile, a title and one line stacked in the cell, and Solutions opens a 2 by 3 grid of six industries, each with its icon beside the text. In both, the cells share hairlines and the panel's own frame, with no gap and no card around a cell, and a "View all" row with an arrow (mirrored in right-to-left pages) closes the grid. Docs (the current page, marked by a foreground stroke on the bar's bottom edge) and Pricing follow as plain links, and Sign in and a Get started Shine Button close the row. Below the md breakpoint a menu button opens a sheet from the top where each menu is an accordion group with the same cells as rows and the same "View all" link. The panels and the sheet open over the page, so the block stays one bar high (64 pixels, 56 on a phone), and the bar draws no bottom border. It's built from Navigation Menu, Accordion, Sheet, Guides, Shine Button and Button, with your theme's tokens for every colour. For product suites whose menus are catalogues rather than lists.

FAQ

How are the shared hairlines drawn?

The grid is gap-px bg-border and every cell is a link with the panel's own background, so the one-pixel gaps show the border colour and nothing doubles. The hover and focus tint is a solid colour on purpose: a translucent tint would let the hairline colour show through the cell. The focus ring is drawn inside the cell, where the cells around it can't cover it. The panel keeps one outer radius and clips the grid to it.

How does it work with a keyboard and a screen reader?

The links sit in a nav landmark named Main, after the wordmark (a link home). Tab reaches the wordmark, Products, Solutions, Docs, Pricing, Sign in and Get started. Enter or Space opens a menu, its button says whether it is expanded, and Escape closes it and puts focus back on its button. Focus stays on the menu's button when it opens; Tab or the arrow keys move into the grid. The arrow keys also move along the bar. The menus also open on hover, and moving between them slides and resizes one panel.

How does it work on a phone?

Below the md breakpoint the wordmark, Get started and a menu button stay on the bar, and nothing wraps at 320 pixels. The menu button says whether the menu is open and which panel it controls; it opens a sheet from the top whose header lines up with the bar. Products and Solutions are accordion groups, closed at first and one open at a time, each holding its six cells as rows (icon, title, description) and the "View all" link; Docs, Pricing, Sign in and Get started sit below them. Focus moves into the sheet and stays there; Escape, the close button or choosing a link closes it, and focus goes back to the menu button. A sheet taller than the screen scrolls.

Does choosing a link close the menu?

Yes, in the panels and in the sheet, so a client-side route change that keeps the navbar mounted doesn't leave a menu open over the new page. Each cell takes closeOnClick. The sheet's open state is held in the block too (sheetOpen), and each of its links closes it. Every link points at #: point them at your pages. Sign in and Get started render the link they're given with render, with nativeButton={false}.

How does it sit on the page, and can it stick to the top?

The navbar is the page's first block: its + marks and rails line up with every block under it, its top rule falls on the window's top edge, and it draws no bottom border, because the next block's top rule is its bottom edge. To keep the bar in view while the page scrolls, add sticky top-0 z-40 bg-background/80 backdrop-blur to the header; the menus still open under it. With reduced motion the panels and the sheet appear without their fades and slides.

  • Pro

    A one-bar navbar for an observability platform whose Products, Resources and Company menus each open a wide panel of three link columns closed by a footer strip, with an accordion of the same links in a sheet on phones.

  • Pro

    A one-bar navbar for a serverless hosting platform whose Platform menu opens a list of five products beside a framed preview that follows the row you hover or focus, with a flat list in a sheet from the start edge on phones.

  • Pro

    A one-bar navbar for a workflow-automation tool whose three triggers each open a narrow flyout under themselves, a plain list, a described list with status badges and a promo card with a small chart, with a caret pointing at the open trigger and collapsible rows in a sheet on phones.

  • Pro

    A one-bar marketing navbar for a product roadmap tool: a wordmark, a Product menu of four areas with icons and one-line descriptions, plain links with the current page marked, Sign in and a Shine Button, and a sheet with the same links on phones.

  • Pro

    A one-bar navbar for a developer cloud whose Platform and Solutions menus open a master-detail panel built as vertical tabs, a list of areas that drives the pane beside it by hover, focus or arrow keys, with a drill-down sheet on phones.

  • Pro

    A one-bar navbar for a workforce-management platform with Platform and Solutions menus, a hairline that splits the bar, and at its end a SOC 2 badge that opens a popover of certifications, then Try demo and a sales button.