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.
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
Installation
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.
Related
- User Profile View SheetA right-side sheet showing a user's
- Order Details SheetA right-side sheet with an order's
- Badge with Text (Standard)A default badge with a short label for a
- Avatar StandardA round avatar with a profile picture and
- Button with Text (Standard)The one filled action
- Standard CardA basic card with a title, a description