Tulip Logo IconTulip

Floating Menu

A floating action bar pinned to the bottom of the screen, e.g. for bulk actions on a selection.

Usage

import { FloatingMenu, FloatingMenuLabel } from "@tulip-systems/ui/floating-menu";
<FloatingMenu open={selected.length > 0}>
  <FloatingMenuLabel>{selected.length}</FloatingMenuLabel>
  <Button variant="outline" size="sm">Verwijderen</Button>
</FloatingMenu>

The menu is fixed to the bottom center of the viewport and hidden when open is false. Override the position through className (e.g. bottom-4 or static).

FloatingMenuClose renders an X button. While the menu is open, pressing escape clicks it, so the button and the shortcut always run the same handler. Escape is ignored when an open dialog or popover already handled it, or when focus is in an input, textarea, select or editable element.

Wrap actions in a FloatingMenuGroup and add a FloatingMenuEmpty right after it. The empty text only shows when the group renders nothing, e.g. when every action is hidden for the current selection:

<FloatingMenu>
  <FloatingMenuLabel>{selected.length}</FloatingMenuLabel>
  <FloatingMenuSeparator />
  <FloatingMenuGroup>
    {canArchive && <Button variant="outline" size="sm">Archiveren</Button>}
  </FloatingMenuGroup>
  <FloatingMenuEmpty>Geen acties voor deze selectie</FloatingMenuEmpty>
</FloatingMenu>

For command-driven bulk actions, use FloatingCommandMenu from @tulip-systems/commands, which renders on top of this component.

API

ComponentPropsDescription
FloatingMenuopen?: boolean (default true) + div propsThe floating toolbar container.
FloatingMenuLabelspan propsText inside the menu, e.g. a count.
FloatingMenuSeparatorSeparator propsVertical divider between groups of items.
FloatingMenuGroupdiv propsWraps the actions; hidden when empty.
FloatingMenuEmptyspan propsShown only when the group before is empty.
FloatingMenuCloseButton propsX button, also triggered by escape.

On this page