Start here
  • InstallationAdd Nelumbo to a shadcn project
  • ThemingBrand accent, neutrals, dynamic color
  • Biology componentsSequences, maps, plates and trees
  • katalyx.bio

    Toolbar

    A toolbar groups the actions that apply to what is on screen. Docked, it is a full-width bar at the bottom of a surface; floating, it is a pill raised above content, optionally paired with a FAB. It has no shadcn equivalent, so there is nothing to swap in. It is one tab stop, and the arrow keys move between its buttons.

    Install

    npx shadcn@latest add @nelumbo/toolbar

    Docked

    Full width, 64px tall, a tonal surface with the items spread evenly. Pressed toggles fill their glyph and morph from a pill into a rounded square. This one uses overflow: shrink the window and the buttons that no longer fit move into a More menu.

    Studio notes

    Spring palette review

    We tested the warm and cool neutrals against the new brand accent and kept the ones that hold their contrast in both themes.

    Selected text takes the formatting from the toolbar below.

    Floating with a FAB

    A pill with an e3 shadow and its items packed. ToolbarFab lives in the same JSX but renders beside the bar, outside role=toolbar. The tool picker is a connected toggle group: the selected tool swells and its neighbours give way.

    Vertical

    orientation="vertical" turns the pill into a column for the edge of a screen. Arrow keys switch to Up and Down, and tooltips open inward (set edge="end" on the trailing edge). The right one is vibrant.

    Colors

    Standard sits on the surface ladder and pressed items turn inverse. Vibrant is inverse itself, with the pressed item flipping to the light fill. Brand uses the accent container. Each has a toggle group.

    Collapse on scroll

    Give a floating toolbar a collapsed state, usually from useToolbarCollapse. Shrink folds every item that is not marked keep into a small pill on a spring; hide slides the bar away and makes it inert. Docked toolbars always hide.

    Scroll the article: it collapses while you scroll down and returns on the way up.

    Designing with springs

    Motion that follows a damped spring feels physical because it starts fast and settles without passing its target. Tune stiffness for how quickly a control reacts and damping for how gently it lands, then reuse the same few curves everywhere.

    Motion that follows a damped spring feels physical because it starts fast and settles without passing its target. Tune stiffness for how quickly a control reacts and damping for how gently it lands, then reuse the same few curves everywhere.

    Motion that follows a damped spring feels physical because it starts fast and settles without passing its target. Tune stiffness for how quickly a control reacts and damping for how gently it lands, then reuse the same few curves everywhere.

    Motion that follows a damped spring feels physical because it starts fast and settles without passing its target. Tune stiffness for how quickly a control reacts and damping for how gently it lands, then reuse the same few curves everywhere.

    Motion that follows a damped spring feels physical because it starts fast and settles without passing its target. Tune stiffness for how quickly a control reacts and damping for how gently it lands, then reuse the same few curves everywhere.

    Motion that follows a damped spring feels physical because it starts fast and settles without passing its target. Tune stiffness for how quickly a control reacts and damping for how gently it lands, then reuse the same few curves everywhere.

    Motion that follows a damped spring feels physical because it starts fast and settles without passing its target. Tune stiffness for how quickly a control reacts and damping for how gently it lands, then reuse the same few curves everywhere.

    Motion that follows a damped spring feels physical because it starts fast and settles without passing its target. Tune stiffness for how quickly a control reacts and damping for how gently it lands, then reuse the same few curves everywhere.

    Overflow

    Set overflow and the toolbar measures its room. Items that do not fit move, in order, into a More menu; toggles show as checked items. Resize the demo to watch it.

    // Manual pattern: your own menu in the last slot<Toolbar aria-label="Actions">  <ToolbarButton icon="edit" label="Edit" />  <DropdownMenu>    <DropdownMenuTrigger asChild>      <ToolbarButton icon="more_horiz" label="More" />    </DropdownMenuTrigger>    <DropdownMenuContent>{/* ... */}</DropdownMenuContent>  </DropdownMenu></Toolbar>

    Keyboard

    Tab
    Moves focus into the toolbar, onto the last button you used, and out again on the next Tab. A toolbar is one tab stop.
    Left / Right
    Horizontal toolbars: previous and next item. Focus wraps at the ends.
    Up / Down
    Vertical toolbars: previous and next item.
    Home / End
    First and last item.
    Space / Enter
    Presses a button or flips a toggle. Toggles expose aria-pressed.
    Escape
    Closes the overflow menu and returns focus to its button.

    Usage

    <Toolbar aria-label="Text formatting" variant="floating">  <ToolbarButton toggle icon="format_bold" label="Bold" shortcut="⌘B" pressed={bold} onPressedChange={setBold} />  <ToolbarSeparator />  <ToolbarToggleGroup type="single" defaultValue="left" aria-label="Alignment">    <ToolbarToggleItem value="left" aria-label="Align left"><Icon name="format_align_left" /></ToolbarToggleItem>    <ToolbarToggleItem value="center" aria-label="Align center"><Icon name="format_align_center" /></ToolbarToggleItem>  </ToolbarToggleGroup>  <ToolbarFab icon="edit" label="Compose" /></Toolbar>

    Props

    Toolbar

    PropTypeDefaultNotes
    aria-labelstringrequiredNames the toolbar for screen readers
    variant"docked" | "floating""floating"Docked: full width, 64px, tonal. Floating: raised pill
    orientation"horizontal" | "vertical""horizontal"Sets aria-orientation and the arrow keys
    color"standard" | "vibrant" | "brand""standard"Surface, inverse, or accent container
    edge"start" | "end""start"Vertical: which edge it sits on (tooltips, hide direction)
    collapsedbooleanfalseCollapse state, e.g. from useToolbarCollapse
    collapse"shrink" | "hide""shrink"Docked toolbars always hide
    overflowbooleanfalseMove items that do not fit into a More menu
    overflowLabelstring"More"Accessible name of the More button
    layoutClassNamestringClasses for the wrapper that holds the bar and its FAB

    ToolbarButton

    PropTypeDefaultNotes
    iconIconNameMaterial Symbols name
    labelstringrequiredAccessible name and tooltip
    togglebooleanfalsePressed state with aria-pressed and the shape morph. Use controlled pressed if it can overflow
    selectedIconIconNameGlyph shown while pressed
    keepbooleanfalseStays visible when the toolbar collapses ("shrink")
    shortcutstringKeys shown in the tooltip
    ...IconButton propssize, width, onClick, disabled, loading

    ToolbarToggleGroup, ToolbarToggleItem, ToolbarSeparator, ToolbarFab, useToolbarCollapse

    PropTypeDefaultNotes
    ToolbarToggleGrouptype="single" | "multiple"requiredRadix toggle group props. Place groups before buttons that may overflow: groups never move into the menu
    ToolbarToggleItemvalue, aria-labelrequiredIcon-only item; give it an aria-label
    ToolbarSeparatorSpace only, no line
    ToolbarFabFabPropsicon and label required. Color follows the toolbar. Renders beside the bar, as its own tab stop
    useToolbarCollapse(ref?, { threshold }) => booleanCollapses on scroll down, returns on scroll up. No ref follows the window