shadcn.io is not affiliated with official shadcn/ui
Email Client Sidebar Block for React
A mail client in a fixed-height window: mailboxes and labels whose counts follow the mail you file, a searchable message list beside the open message, and Compose for a local draft.
Installation
Overview
Give a mail app its whole shell with this email client sidebar for React with Base UI. A window framed by a hairline with a plus mark on each corner holds the Sidebar: the product's mark, five mailboxes (Inbox, Drafts, Sent, Archive and Trash) and three labels, each with a count worked out from the typed messages, and the signed-in person at the foot. Beside it, a top bar names the open mailbox and holds Compose, a Shine Button and the only colored control. The page is the mailbox's message list, with an Input to search it, beside the open message: its subject, sender, time, labels and text. File a message with its Select and it moves, both mailboxes' counts change and a status line says so; Compose starts an untitled draft and Drafts counts one more. The rail collapses to icons with tooltips, and below the medium breakpoint it becomes a sheet, while the list and the message share one pane with a Back button. Empty mailboxes and searches that find nothing show an Empty state, and the window never changes height. It's built from Sidebar, Select, Input, Empty, Avatar, Badge, Button, Shine Button and Guides, with a CSS entrance only. For mail, support inboxes, messaging and any app whose navigation shows counts.
FAQ
Where do the counts come from?
From MESSAGES, the 14 typed messages at the top of the file. Each has a folder (inbox, drafts, sent, archive or trash) and its labels. A mailbox counts the messages in its folder, a label counts the labelled messages that aren't in Trash, and the list's line counts the open mailbox and its unread messages. Nothing is typed twice: file a message or start a draft and every count follows from the same list. A mailbox with nothing in it shows no badge. In your app, take the counts from your server and keep the same rule: one source for the list and the badges.
What stays in the page, and how do I connect it?
Everything. Opening a message marks it read, the Folder select moves it, Compose adds an untitled draft and the search filters the open mailbox, all in the block's own state; nothing is sent or received, and reloading starts over. Replace those handlers with your API: move the message on the server, then update the list from the result. The mailboxes are links to # whose handler shows the mailbox instead of navigating. They're SidebarMenuButtons with render set to an a element. Point them at your routes and mark the current one with isActive.
How does it work on a phone?
Below the medium breakpoint the sidebar becomes a sheet that the menu button in the top bar opens from the start edge, the right in a right-to-left layout. Escape or choosing a mailbox closes it and focus goes back to the menu button. The list and the open message share one pane: choosing a message opens it and moves focus to its subject, and Back returns to the list with focus on the same message. Filing a message returns to the list too. The window keeps its height, and the status line at its foot says what changed.
What happens when the sidebar collapses?
The menu button or the rail along the sidebar's edge folds it to its icons. Each icon keeps its link's full name for screen readers, and a tooltip shows the mailbox and its count on hover or focus. The provider is set with persist={false} and shortcut={false}, so the block writes no cookie and leaves Ctrl and Command with B to the page it sits on. For a full-page mail app, remove both to remember the state and get the shortcut, and give the provider your page's height instead of the window's.
Is it accessible?
The sidebar is a navigation landmark named after the product, with each group of links named by its label and the open mailbox marked as the current page. Each link's name says its count ("Inbox, 7 messages"). The messages are a list of buttons that say who wrote them, whether they're unread and which one is open. The open message is a scrollable region you can reach with Tab. One polite status line reports each change, and the counts, names and subjects are isolated so they read right in a right-to-left layout.
Why is the window a fixed height?
So the whole app fits on one screen, with its frame drawn around it: 576 px tall on phones and 736 px from the medium breakpoint. Only the parts inside scroll (the sidebar, the list and the message), never the window or the page, and nothing you do changes its height: a search that finds nothing or an empty mailbox shows an empty state in the same space.
Related
- Pro
Email Triage Inbox Features
App screensA working triage list for an email app: seven conversations with checkboxes, where ticking rows swaps the toolbar for a bulk bar in the same space, with E and Z shortcuts and per-row buttons on hover.
- Pro
Split Panel Inbox Zero CTA
Product previewsA split CTA for an email app: the headline, a status line and a Shine Button beside a working inbox panel that runs flush to the rail and the section's foot. Archive any of five messages and the row folds away, the count follows, and an Inbox zero state appears at the end.
- Pro
Sidebar Toggle Navbar
Mobile and drawersA navbar with a sidebar toggle for a project tracker: a button, the [ key and a tooltip fold a mini sidebar under the bar between icons only and icons with labels, and on phones the same button opens it as a sheet.
- Pro
Sidebar Nav Changelog
Filters and browsingA docs site's release notes with a side navigation of four categories and their counts: current one marked, eight releases at the end, one divider with a plus mark, and chips that scroll on a phone.
- Pro
Collapsible Sidebar FAQ
NavigationA sidebar FAQ for a holiday-rental site: a topic rail with two collapsible groups and a live count, beside a filtered list, and a native select on phones.
- Pro
Emoji Labels Sidebar
App contentA team wiki in a fixed-height window whose muted sidebar gives every page a glyph you choose from a popover of eight named icons, shown in the rail and in the page title, with a Reset icons button.