shadcn.io is not affiliated with official shadcn/ui
Brand Header Sidebar Block for React
A design-operations suite in a fixed-height window whose sidebar header is a brand lockup that opens a menu to go home, copy the logo name, copy the mark as SVG or open the brand guidelines.
Installation
Overview
Make the logo in the corner do something with this brand header sidebar for React with Base UI. A window framed by a hairline with a plus mark on each corner holds the Sidebar, and the lockup in its header, the mark, the wordmark and a Staging Badge, is one button that opens a Menu: Back to home, Copy logo name, Copy mark as SVG and Brand guidelines. The two copy items really write to the clipboard and a status line says what was copied, or that this page can't reach the clipboard; the Brand page lists what you copied and shows the last text. The trigger that folds the rail sits at the end of the header, and folded to icons only the mark remains, still the menu's button. Five typed pages (Overview, Projects, Reviews, Brand and Handoffs) follow the links in the rail. It's built from Sidebar, Dropdown Menu, Badge, Avatar and Guides, with a CSS entrance only. Below the medium breakpoint the rail is a sheet. For any app whose logo is also its home button, workspace menu or brand kit.
FAQ
Do the copy items really copy?
Yes: they call navigator.clipboard.writeText with the logo name or with the mark's SVG source, which is built from the same path data that draws the mark, so the two can't drift apart. Browsers allow it on a secure page, after a click or a key press. When the write is refused, the status line says "Could not copy" and the Brand page adds nothing, so what the page lists is always what reached the clipboard. The Brand page then shows the last text in a code block, which also makes the result checkable on a page where the clipboard is out of reach.
What stays in the page, and how do I connect it?
Everything but the clipboard. The five pages, their rows and the list of copied items are typed or kept in the block's own state; "Back to home" and "Brand guidelines" show a page here instead of navigating. Replace the handlers with your routes: home, your brand-kit page, and your real mark's SVG in place of MARK_PATHS. The rail's links go to # whose handler shows the page. They're SidebarMenuButtons with render set to an a element.
What happens when the sidebar collapses?
The wordmark, the Staging badge and the fold button leave, and the mark stays as a 32 px button that still opens the same menu, with its name "Opalcrest menu". Because the fold button leaves with the labels, the menu button in the top bar appears and takes focus if the fold dropped it. The rail along the sidebar's edge also folds and unfolds it. 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.
How does it work on a phone?
Below the medium breakpoint the sidebar is a sheet that the menu button in the top bar opens from the start edge, the right in a right-to-left layout. The lockup is in the sheet's header with the same menu, and a button at its end closes the sheet; Escape or choosing a page closes it as well. The window keeps its height, and the status line reports each copy.
Where does focus go after a menu choice?
Back to the lockup, on every library. Each choice runs its handler, then returns focus to the button that opened the menu a moment later, since some libraries leave it on the page after a pointer choice. Escape closes the menu with focus on the lockup too. The menu is a standard menu: arrow keys move through its items, and Enter or Space chooses one.
Is it accessible?
The lockup is a button named "Opalcrest menu" whatever the rail's width, and the menu is announced as one. The rail is a navigation landmark named after the product with each group named by its label, and the open page is marked as the current page. The mark is decorative and hidden from assistive technology. One polite status line reports the page and each copy result, and the page's heading names the open page.
Related
- Pro
Header Actions Sidebar
Headers and sectionsA notes app in a fixed-height window whose slim sidebar header holds three ghost icon buttons with tooltips: New note adds and opens a note, Search filters the notes, and the third folds the rail.
- Pro
Email Client Sidebar
App contentA 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.
- 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
Scrollable Content Sidebar
Headers and sectionsAn all-in-one workspace in a fixed-height window whose wide sidebar scrolls six groups of pages under sticky group labels, with a line that says which group is at the top and a Jump to select that scrolls to one.
- Pro
Separator Sections Sidebar
Headers and sectionsA team hub in a fixed-height window whose sidebar tells its three sections apart three ways, with labels, with hairlines or with space alone, chosen from a segment group while the ten rows and the open page stay put.
- Pro
Simple Groups Sidebar
Headers and sectionsA company handbook in a fixed-height window whose muted sidebar has four groups of pages and a density toggle: Roomy, Default and Compact set the size of the rows and the gaps, and the rail prints the measured row height.