Skip to content
Cynosurev0.5.0
SearchStorybookGitHubnpmColour mode: System. Switch to Light

Components / Structure

StatusBar

The bar along the bottom of a desktop app or editor: short status segments (connection, branch, cursor position, problems) in a start and an end cluster. Segments that do something are buttons, and one can open a Popover above itself.

Start and end clusters

When to useLink to "When to use"

  • The status line of an app shell: what is connected, where the cursor is, what needs attention.
  • Short, glanceable state with a few quick actions behind it (switch connection, show problems).

Use something else when:

  • the row holds actions rather than state: a Toolbar
  • the message needs reading or acting on now: a Notice or a Toast
  • the bar is the app's menu: a Menubar
  • it is a page footer with links: SiteFooter

UsageLink to "Usage"

tsx
Copy
import { StatusBar, StatusBarSegment } from "@arshad-shah/cynosure";
import { gitBranch, warning } from "@arshad-shah/cynosure/icons";

<StatusBar
  label="Status"
  start={
    <>
      <StatusBarSegment
        variant="solid"
        tone="accent"
        dot
        dotTone="success"
        dotLabel="Connected"
        popover={<ConnectionList />}
        popoverLabel="Connections"
      >
        main-db
      </StatusBarSegment>
      <StatusBarSegment icon={gitBranch} mono>
        feature/login
      </StatusBarSegment>
    </>
  }
  end={
    <>
      <StatusBarSegment mono>Ln 12, Col 4</StatusBarSegment>
      <StatusBarSegment tone="warning" icon={warning} onClick={showProblems}>
        2 warnings
      </StatusBarSegment>
    </>
  }
/>

SegmentsLink to "Segments"

A segment is its text (children) with an icon or a status dot before it. tone colours a plain segment's text and icon, or fills a soft (tinted) or solid segment. mono sets the text in the monospace face, for positions, paths and versions.

The dot is a Badge status dot: dot is true for a steady one or "live" for a pulsing one, in dotTone (default: the segment's tone). When the text does not say the state (a database name beside a green dot), give dotLabel, and the dot becomes part of the segment's name ("Connected main-db"); without it the dot is decoration.

Dot tones

Clickable segments and popoversLink to "Clickable segments and popovers"

With onClick a segment is a Button of size xs, flat and as tall as the bar. With popover it opens that content in a Popover above itself (placement, default top, flips when it does not fit), named by popoverLabel; open, defaultOpen and onOpenChange control it, so another control can open it too.

Popover opens upward

Long textLink to "Long text"

Text wider than --cy-status-bar-segment-max-width ends in an ellipsis, and the full text shows in a tooltip on hover (and on keyboard focus for a clickable segment). Text that fits has no tooltip.

Long text shows in full in atooltip

PropsLink to "Props"

Every prop of StatusBar
PropWhat it doesTypeDefault
labelRequired
Accessible name of the bar, a toolbar ("Status"). Required: a toolbar must be named.string
start
Segments at the start of the bar (left in left-to-right text): connection, branch, schema.ReactNode
end
Segments at the end of the bar (right in left-to-right text): cursor position, encoding, plugin status.ReactNode
className
Added to the root element, for layout.string
style
Layout only. Restyle through --cy-status-bar-* tokens.CSSProperties
data-testid
Test id, set on the bar element.string

Generated from the type definitions in @arshad-shah/cynosure 0.5.0.

StatusBarSegment takes children, tone, variant, icon, dot, dotTone, dotLabel, mono, label, onClick, popover, popoverLabel, placement, open, defaultOpen, onOpenChange, disabled, className and style.

Behaviour and accessibilityLink to "Behaviour and accessibility"

Behaviour and accessibility, table 1
InputResult
TabEnters the bar on one clickable segment (the one last used); Tab again leaves it
Left arrow / Right arrow arrowsMove between clickable segments across both clusters, wrapping; status-only and disabled segments are skipped
Home / EndFirst / last clickable segment
Enter, Space or clickPresses the segment, or opens or closes its popover
Escape in a popoverCloses it and returns focus to the segment
Click outside a popoverCloses it
  • Role: toolbar named by label, with aria-orientation="horizontal". Not status: a live region would read out every change in the bar (cursor positions, counters). Announce what matters with Announcer.
  • Popover segments have aria-haspopup="dialog", aria-expanded and aria-controls; focus moves into the panel, and arrow keys inside it are the panel's.
  • Long text keeps its full text as the accessible name; the tooltip is not a title attribute.
  • Right to left: the start cluster sits on the right, and Left and Right swap.
  • Shadow DOM: works inside a shadow root (arrow keys, popover and focus return).

TouchLink to "Touch"

Clickable segments look dense but their hit area is at least 24px, and 44px on coarse pointers; the bar keeps its height. A tap opens a popover; tooltips never open on touch.

ThemingLink to "Theming"

Tokens: --cy-status-bar-height, --cy-status-bar-background, --cy-status-bar-border (the top line's colour), --cy-status-bar-font-size, --cy-status-bar-padding-inline (inside each segment), --cy-status-bar-segment-max-width, --cy-status-bar-gap and --cy-status-bar-soft-mix (the tint of a soft segment, static or clickable).

ts
Copy
createTheme({ components: { statusBar: { height: "22px", segmentMaxWidth: "24ch" } } });

Toolbar · Badge · Popover · Tooltip · Menubar

These examples run Cynosure 0.5.0 (commit 50ce30b), the version on npm.

Getting started
Theming
Icons
Accessibility
Code editors and highlighters
Using Cynosure without React
Build-tool adapters
Components
Accordion
AppShell
AspectRatio
Breadcrumbs
Calendar
Card
Container
Disclosure
Divider
DocumentViewport
Grid
Inline
PageHeader
PanZoomCanvas
ScrollArea
SideNav
SortableList
SplitPane
Stack
StatusBar
Tabs
TitleBar
Toolbar
Tree
VirtualList
ZoomControls
Announcer
Avatar
Badge
CodeBlock
DescriptionList
EmptyState
ErrorBoundary
Field
Heading
IconTile
Image
Kbd
List
LoadingDots
Notice
ProgressBar
Prose
Skeleton
Stat
Steps
Table
Text
Button
Checkbox
Checklist
ColorField
ColorSwatches
Combobox
CompareSlider
CopyButton
DateField
FileDrop
IconButton
KeyValueEditor
Link
NumberField
Pagination
PathField
RadioGroup
SearchField
SegmentedControl
Select
SelectionFrame
SignaturePad
Slider
Switch
TagInput
TextArea
TextField
ThemeToggle
TimeField
ButtonBase
ChoiceBase
DialogBase
FileInputBase
HiddenValue
Icon
InputBase
LinkBase
LiveRegion
TextAreaBase
ChatMessage
Choice
DataGrid
DeviceFrame
HighlightedText
HotkeyField
ListRow
OptionList
OverlayFrame
QRCode
RowActions
Section
SiteFooter
SiteHeader
SkipLink
SortButton
VisuallyHidden
CommandPalette
ContextMenu
Dialog
FloatingToolbar
HoverCard
Menu
Menubar
Popover
ProgressOverlay
Sheet
Toast
Tooltip
Changelog