videorc/ui

Status Bar Action

One action in a status bar. An icon, a word or both, with its shortcut, named for assistive tech and on hover by a tooltip, never a native title. It can be a toggle, or a menu's trigger.

Chat from YouTube and Twitch shows up here while you're live.

2 destinations

Installation

$ pnpm dlx shadcn@latest add @videorc/status-bar-action

Usage

import { StatusBarAction } from "@/components/status-bar-action";
<StatusBarAction
  accelerator="CmdOrCtrl+Shift+C"
  icon={<ClipIcon aria-hidden />}
  label="Save a clip"
  text="Clip"
/>

Use it for a control in a Status Bar that isn't a window's shortcut hint: an icon action, a toggle, a menu. It's its own module, so a status bar of hints alone never loads its Tooltip.

Don't use it outside a status bar, where a control is a Button. Don't give it a title: label names it, and the tooltip shows the name or the hint.

The tooltip follows what the action shows:

It showsIts tooltip
An icon aloneThe label
A word (text)None: the word says it
Anything, with a hintThe hint, which is also the button's description

As a menu trigger

Its props spread onto the button, so it can be a menu trigger's render. The demo's clip length does this:

<DropdownMenu>
  <DropdownMenuTrigger
    render={<StatusBarAction label="Clip length" text="30 s" />}
  />
  <DropdownMenuContent side="top">…</DropdownMenuContent>
</DropdownMenu>

Theming

Token or attributeMeaning
STATUS_BAR_ACTION_CLASS20 px, 11 px tertiary text that brightens on hover, 14 px icons
aria-pressed:text-foregroundA toggle that's on
text-muted-foregroundThe shortcut, a step above the word
data-slot="status-bar-action"The button, kept when a trigger renders it
data-popup-openWhile its menu or tooltip is open, from Base UI

Keyboard

KeyAction
TabMoves to the action and shows its tooltip
Enter, SpaceRuns it, toggles it, or opens its menu

Accessibility

label is the button's aria-label, so an icon alone is still named; pass icons with aria-hidden. A hint becomes the button's aria-description as well as its tooltip. pressed sets aria-pressed for a toggle.

API reference

Every button attribute except children and title, plus:

Prop

Type