Axon 911 Frontend DocsAxon 911 Frontend Docs
Axon 911 Frontend Docs
    Loading navigation…
U
User
Switch to light mode
  1. Blocks
  2. Floating Toolbar
  3. Usage

Floating Toolbar

Usage

Import @prepared911/ui/blocks/floating-toolbar and its styles.css, plus the styles.css of each component the block composes (Box, Button, Icon, Menu, Separator, Toolbar). FloatingToolbar is the floating control row for call-taking actions. It is a placement and a set of actions: the row itself is Toolbar, so it keeps Toolbar's one tab stop, arrow-key movement, and gliding hover highlight. It is not a panel and not the Dock.
Where to mount it
Mount it inside the workspace region of the shell, the positioned region the call-taking content fills. The shell's other scroll regions and its dock sit outside that region, so the toolbar never covers them.
  • The block renders a placement layer that fills the nearest positioned ancestor (position: absolute, inset: 0) and lets every pointer through, so the content under it keeps its clicks and wheel input. Only the toolbar itself takes input.
  • The workspace region must be positioned and must not scroll itself. A toolbar mounted inside a scroll container scrolls away with the content.
  • Do not mount it in the shell root or a region that spans a scroll region or the dock. The layer is as large as its positioned ancestor, and the toolbar rests against that ancestor's edge.
  • The default inset of 16 keeps the toolbar clear of the scrollbar gutter of a scroll area that fills the region.
Placement
placement is a logical enum, never a coordinate. Each member names an edge and the alignment along it: BlockEndCenter (default), BlockEndStart, BlockEndEnd, BlockStartCenter, BlockStartStart, and BlockStartEnd. Start and end follow the writing direction, so the toolbar mirrors under dir="rtl" with no other prop. The toolbar is always a horizontal row: there is no inline-edge placement, and the arrow keys are Left and Right. inset (4, 8, or 16) is the space-token distance from the workspace edge.
Actions
Every action is a Button with a visible label; label is required and is also the row text in the overflow menu. An action is either a command (onAction, optional intent) or a toggle (pressed and onPressedChange). The caller owns pressed; the toolbar never flips it. Accent, Destructive, and Success commands paint solid so they stand out from the Ghost row; every other action keeps Toolbar's Ghost paint.
Overflow
The toolbar measures the room the workspace gives it and keeps every action in the bar while they fit. When they do not, it takes room for an overflow control and moves the last unpinned actions into a Menu, so the menu reads as the tail of the bar. A command becomes a menu item; a toggle becomes a checkable row. Mark an action pinned to keep it in the bar however narrow the workspace gets, such as End call. The menu opens toward the inside of the workspace.
Minimize and the Dock
minimized and onMinimizedChange are controllable. The minimize control calls onMinimizedChange(true, details). A controlled host sets minimized and shows the way back; uncontrolled, the toolbar hides itself, but only the host can bring it back, so pair every minimize control with a restore control. FloatingToolbar does not import Dock. The pairing belongs to the host, which owns one minimized flag and renders both sides from it:
  • Add the Dock item when minimized becomes true and remove it when it becomes false. The item's onRestore sets minimized back to false.
  • When the minimize control had focus, the toolbar becomes inert and focus falls to the page. Move focus to the Dock item from onMinimizedChange (the details carry the event and the control), or let the Dock's own focus fallback do it.
  • Restoring does not move focus. The Dock item the person pressed keeps it. The next Tab into the toolbar lands on the first action, because restoring starts the roving tab stop over.
  • The toolbar fades and travels toward the edge it rests against over the glide exit tokens, then is hidden, inert, and out of the tab order. Restoring fades it back on the glide enter tokens. Reduced motion keeps the fade and drops the travel.
Controls the block names
The minimize and overflow controls take minimizeLabel and moreLabel (LocalizedMessage). The minimize control is always an icon-only Button that shows the X glyph (Lucide x), named and described by a tooltip with minimizeLabel. It takes no icon prop, so every toolbar dismisses the same way. The overflow control takes an optional moreIcon glyph; with one it is an icon-only Button named by moreLabel, without one it shows moreLabel as text.
Previous
Detail Drawer / Accessibility
Next
Floating Toolbar / API and Development
On this page
Where to mount it
Placement
Actions
Overflow
Minimize and the Dock
Controls the block names