shadcn.io is not affiliated with official shadcn/ui
Workspace Top Bar Banner Block for React
A top bar for a team workspace manager that says which workspace you are in, with your role as a badge and a Switch menu of workspaces behind a divider.
Installation
Overview
A top bar for React with Base UI, a line that tells you where you are before you act. Juniperwell's strip sits between the page's rails: an avatar with the workspace's initials, "You are in Harbor & Pine" with the name in medium weight, and an outline "Owner" badge. At the end, in a cell of its own behind a solid divider that meets the top rule with a plus, a ghost "Switch" button opens a menu with a radio list of three workspaces. Choosing one rewrites the line, the initials and the role (Admin in Lantern Row, Member in Tern Studio) and a polite status line says it. The three versions of the line share one grid cell, so the strip stays 44 pixels on a desktop and two lines at most on a phone. It is built from Guides, Avatar, Badge, Dropdown Menu and Button, and follows your theme. The workspace names belong to the customer; the product's name is the vendor's.
FAQ
Where do the workspaces and roles come from?
From WORKSPACES at the top of the file: an id, the initials for the avatar, the name and the visitor's role in it. Replace the list with your account's workspaces and call your own function in choose to switch the session. The line, the avatar and the badge are all drawn from the current item, so nothing else needs changing.
How does the menu work with the keyboard?
Tab reaches "Switch"; Enter, Space or the arrow keys open the menu, the arrow keys move between the three workspaces, typing jumps to one by its first letters, and Enter chooses it. Escape closes the menu and returns focus to the button. The list is a radio group, so the current workspace is marked and announced as selected. The exact details come from the library you chose.
Why doesn't the bar change size when I choose a workspace?
All three versions of the line are drawn in the same grid cell: the current one, and an invisible, inert copy of each, so the cell is always as big as the biggest. The divider cell stays at the end and the strip stays one line on a desktop whichever workspace is chosen.
What does a screen reader say after a switch?
A polite status line, present from load and empty until the first choice, says "Switched to Lantern Row. Your role is Admin." The avatar is decoration and hidden from assistive technology; the badge reads "Your role: Owner" as part of the sentence.
Related
- Pro
Saved Draft Top Bar Banner
Utility barsA top bar for a writing tool that reports its autosave with a green dot and a ticking time, and a Restore previous button that swaps in place to Restored with an Undo.
- Pro
Language Switch Top Bar Banner
Top barsA top bar for a news site that translates itself: one line in English, Spanish or Arabic, with an underlined button that switches the line to the next language and flips it to right to left for Arabic.
- Pro
Dropdown Multi-Action Banner
Choices and promptsA region prompt for a data platform: a Select of four regions with their latency beside a Shine Button Continue and a ghost Skip, with a line that says why Continue waits.
- Pro
A language pill for a travel-guide site: a globe, "Guides in" and a button naming the current language, opening a popover of six languages written in their own scripts.
- Pro
Top Bar Banner
Top barsA slim announcement strip for a writing app's release: one centred line with the version, the news and an underlined link, and a ghost button that folds the strip away.
- Pro
Team Presence Live Banner
Live statusA presence callout for a team workspace: a live "4 of 5 teammates active" count over a band of five cells, each an initials avatar with an active or idle dot, a name and the document they are in.