shadcn.io is not affiliated with official shadcn/ui
Pinned Message Chat Navbar Block for React
A conversation header for a team chat app: the channel name and member count, a one-line pinned message that cycles to the next pin when pressed, member avatars and Voice and Video call links with tooltips.
Installation
Overview
A navbar for a chat app in React with Base UI. It is the header of one conversation in Quillhearth, a team chat app: a channel tile and the name "kitchen-crew" lead, the member count beside it, and under them one line, the channel's pinned message ("Pinned 1 of 3: Friday's menu is locked…"). Pressing the line shows the next pin, round to the first, and the three lines share one cell, so the bar never changes height however long a pin is: it truncates with an ellipsis. A hairline divides this half from the other: member avatars and the Voice and Video call links, named by tooltips. On a phone a back arrow replaces the tile, and the avatars and the member count give way. Nothing is sent or called: the links go to #. It's built from Avatar, Tooltip, Button and Guides. For chat, messaging and collaboration products whose pinned messages deserve to stay in view.
FAQ
How do I change the pinned messages?
Edit PINS at the top of the file: an id and the text of each. The line, its "Pinned 2 of 3" counter and the spoken sentence all derive from the list, so adding a fourth pin changes the counter to "of 4". Long text is cut with an ellipsis; the full sentence is the button's accessible name.
How does a screen reader hear the change?
The pin line is one button whose name is the whole sentence plus "Show the next pin". When you press it, a hidden status region (present from page load, empty until the first press) says the new pin, for example "Pinned 2 of 3: Deliveries move to the side door…". Focus stays on the button, so you can keep pressing it.
Why doesn't the bar change height when the pin changes?
All three pins are stacked in one grid cell and the two that aren't current are invisible, so the cell is always as wide and as tall as the widest and tallest pin. Nothing moves when you press.
How do the call links and tooltips work?
Voice call and Video call are links to # (point them at your call routes), each named by its own hidden text and a tooltip on hover and focus.
Escape closes a tooltip; on hover it appears after a short delay.
Related
- Pro
Contextual Navbar
Cells and splitsA navbar with a Site | App segment control whose two link sets and action sets cross-fade in one grid cell, so the bar's width and height never change.
- Pro
Breadcrumb Page Header Navbar
Page headersAn app page header: a Back button, the trail with the current page's title and a Draft badge, then behind a split divider who edited it and how long ago, and a Settings link.
- Pro
Icon-Only Navbar
Cells and splitsAn icon-only navbar for a messaging app: six destinations in square cells on shared hairlines, each named by a tooltip, with unread dots and a Show labels toggle that widens the cells to reveal the words.
- Pro
Presence Avatars Navbar
Accounts and scopesA shared-document navbar with presence avatars and an editing count, and a Share popover holding the roster, a viewing switch and a link that copies.
- Pro
Notification Bell Navbar
Meters and progressAn app navbar for a team inbox with a bell whose count follows what you do: the bell opens a panel with All and Unread tabs, rows you can mark read, mark unread or dismiss, and Mark all as read, and a drawer on phones.
- Pro
Composer Ring Social Platform Navbar
Calls to actionA navbar for a neighbourhood network: four links with an unread count, a profile avatar and a Create post button that opens a composer with a 280-character ring and a Post button that disables over the limit.