Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Dialog examples · Standard

Scrollable Dialog for React

A privacy policy dialog whose long text scrolls in a fixed-height area between the header and the footer.

Framework
UI library

Long documents don't fit in a standard dialog. This React dialog shows a privacy policy in a fixed-height Scroll Area between the header and an I Understand button, so the title and the action stay in view. It's shadcn.io's Dialog on Base UI.

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 tall should the scroll area be?

h-75 here. On small screens a viewport-relative height such as max-h-[60vh] keeps the dialog on screen.

How do people know it scrolls?

The scroll area shows its scrollbar while scrolling. A fade at the bottom edge adds a hint that there's more.

Can keyboard users scroll it?

Yes. Focus the scroll area and use the arrow keys, Page Up and Page Down, or Space.

How wide should it be?

sm:max-w-lg keeps lines at a comfortable reading length.

Does I Understand close the dialog?

Yes, it's a DialogClose. To require reading to the end before accepting, see the Terms and Conditions dialog example.