Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Browser Tab Notification Block for React

A webmail's unread count in a browser tab, drawn: New message adds the next of four, Clear reads them, and a toggle shows the tab in view or both titles a background tab swaps between.

Framework
UI library

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

Show people how an unread count reaches the browser tab, with this browser tab for React with Base UI. It's the tab of Tabloft, a webmail, drawn in a hairline frame with a plus mark on each corner: a tab strip, an address bar and an inbox of five messages under it. "New message" lets in the next of four typed messages, so the count in the tab's title goes up ("(4) Inbox · Tabloft", stopping at "(99+)") and a new row appears at the top of the inbox; Clear reads them all and takes the count out of the title. A Toggle Group switches between the tab in view, with its one title, and the tab in the background, where an app that wants attention swaps the title between two lines on a timer; here both are drawn side by side, so nothing flashes. Only the drawn tab changes: the page never touches your real tab title, and the line under the frame says so. It's built from Button, Toggle Group and Guides, with a CSS entrance only. For a webmail, a chat or any app that wants to be noticed from another tab.

FAQ

Does it change my real tab title?

No. Nothing in the block writes document.title; the tab, the address bar and the inbox are drawn, and the line under the frame says "This tab is drawn: your real tab title is never changed." In your app you would set the title from the same helper: document.title = titleOf(unread) in an effect keyed on the count.

What does the background tab show, and why two titles?

An app that wants attention from a tab you aren't looking at usually swaps its title between the count ("(4) Inbox · Tabloft") and the newest message ("Tomas: Standup moved to a quarter to ten") every few seconds. Here nothing swaps: the strip draws both titles side by side and the line under the inbox spells them out, so the block has no timer and nothing flashes. With nothing unread there is nothing to swap in, and the second tab is a plain new-tab placeholder. If you build the real swap, run it only while the tab is hidden, stop it when it becomes visible, and keep it slow.

What stays local, and how do I make it real?

The four messages are in ARRIVALS and the five that were already there in START; "New message" lets the next one in and Clear marks everything read, all in the page, and a reload starts again. To make it real, feed unreadOf from your own inbox, call your server when messages are read, and set the real title as above. The count is worked out from the list, never typed.

Is it accessible?

The drawn browser is one figure with a name, the title in the tab is real text, and the line under the inbox says in words what the tab reads. Unread messages are a dot, a bolder sender and the word "Unread" for a screen reader, never a colour. The buttons and the toggle group are named and work with the keyboard, and a polite status message says what each press did and what the tab reads now.

What happens past 99?

titleOf stops the count at 99: the title reads "(99+) Inbox · Tabloft", the way a title is kept short in a real tab. The demo only lets four messages in, so you won't reach it by pressing; change START to see it.

How does it look on a phone?

The buttons and the toggle group wrap onto two rows, the two drawn tabs share the strip with their titles cut short (the full text is in the line under the inbox), and the inbox keeps one height and scrolls inside, so a new message never moves the page.

  • Pro

    A UI kit's count badge drawn on three header buttons: a number field sets the bell, a toggle switches number and dot, and each cell prints what is shown and what a screen reader hears.

  • Pro

    The list under a CRM's notification bell, shown open under its top bar: five notifications that mark themselves read when pressed, a bell whose count and name go down with them, Mark all read and See all.

  • Pro

    Real-Time Notification Feed

    Live and empty states

    A live status feed that doesn't jump: a typed script of six events starts when you press Start, new ones wait in a pill above the list, and pressing the pill lets them in at the top.

  • Pro

    A news app's push permission ask drawn in a browser window: a soft card on the page, a drawn browser prompt with Allow and Block, and the three outcomes, with a line that says nothing is asked of your real browser.

  • Pro

    A notifications panel that slides in from the end of a sales pipeline's page, open on load: a bell that toggles it, five rows that mark themselves read, and Clear all with an exact Undo.

  • Pro

    A notification centre as a narrow panel: tabs for All, Mentions and Alerts with their own unread counts, rows you press to mark read, a mark all read for the open tab and a clear with an undo.