Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Sheet examples · Details

Notification List Sheet for React

A right-side sheet listing notifications, with initials, a dot on the unread ones and a Mark All as Read button.

Framework
UI library

A notification feed in a right-side sheet. Each row has the sender's initials in an Avatar, what they did and when; unread rows get a muted background and a dot. The unread count is worked out from the data, so the badge on the trigger and the description always agree.

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 are unread notifications marked?

Unread rows get bg-muted/50 and a small dot at the end of the row. The dot holds a visually hidden Unread, so the state isn't color alone.

Where does the unread count come from?

From the data: the demo counts the items with unread: true, and both the trigger's Badge and the description use that number. Two of the four start unread.

Why initials instead of photos?

The rows use AvatarFallback with the sender's initials on the primary color. Add an AvatarImage before the fallback to show a photo; the initials stay as the fallback while it loads or if it fails.

Does Mark All as Read clear the dots?

Not in this demo: the list is static and the button has no handler. Keep the items in state and set unread to false on every one when it's pressed.

How does the Notifications button open the sheet?

The outline button labeled Notifications is the trigger, and its text is the accessible name. The badge inside it is part of that name, so it's read as Notifications 2. 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 Notifications, and the description reads You have 2 unread notifications.