Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Sheet examples · Multi Section

Sheet with Sticky Header and Footer for React

A right-side product sheet whose middle scrolls between a header and a footer that stay in place.

Framework
UI library

Header and footer stay put, the middle scrolls. SheetContent is a flex column, the body takes the free height with flex-1 overflow-y-auto, and a Separator marks each edge of the scrolling part. Add to Wishlist and Add to Cart stay in reach however far people scroll.

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.

FAQ

How do the header and footer stay in place?

They don't need position: sticky. SheetContent is a flex column, and only the body between them scrolls, with flex-1 overflow-y-auto.

What are the lines above and below the body?

Two Separators, one after SheetHeader and one before SheetFooter. They show where the scrolling part starts and ends.

What's in the scrolling body?

Three sections, Description, Specifications and Reviews, each with an h4 heading. Specifications is a list of four lines.

How does View Details open the sheet?

The button labeled View Details is the trigger, and its text is the accessible name. The Button goes in the render prop of SheetTrigger, and the label stays its child.

What does the sheet announce?

SheetTitle names the dialog for assistive tech, so every sheet renders one; hide it with sr-only when the design has no visible heading. It reads Product Information, with Detailed product specifications and features as the description.