Floating Controls

Modular action strip for canvas toolbars and docks.

Also known as: floating toolbar, canvas action bar, tool action strip, overlay controls

Installation

Install with the CLI, or copy the component source into your project.

Add floating-controls (npm)

npx --yes -p @default-file/ui df-ui add floating-controls

Default

Surface bar with text actions and a divider after Reset.

Overlay

Always-dark glass for tool canvases. It does not follow light or dark page theme. Use surface for themeable chrome.

Items API

Build the bar from an items array. Place dividers anywhere, swap divider content, or drop in custom nodes.

Padding

Bar inset from none to 2xl. Default keeps the standard bar inset.

none
sm
default
lg
2xl

Radius

Corner radius from none to full. Default is xl.

none
sm
md
lg
xl
2xl
3xl
full

Properties

Modular action bar with items, dividers, and slots. Label ink is optically centered to cap height with text-box when available, and a 1cap line box otherwise. Pass children or an items array.

FloatingControls

PropTypeDefaultNotes
variant"surface" | "overlay""surface"Bar surface treatment.
padding"none" | "sm" | "default" | "lg" | "2xl""default"Inner inset around the bar.
radius"none" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "full""xl"Corner radius of the bar. Maps to a --radius-* token.
itemsFloatingControlsEntry[]-Declarative entries (item, divider, slot). Ignored when children are passed.
childrenReactNode-Compose FloatingControlsItem, Divider, and Slot manually.
classNamestring-Additional styles on the bar.

FloatingControlsItem

PropTypeDefaultNotes
leadingReactNode-Leading icon or mark.
trailingReactNode-Trailing icon or mark.
tone"ghost" | "solid""ghost"Item emphasis.
childrenReactNode-Item label content.
classNamestring-Additional styles on the item button.

FloatingControlsDivider

PropTypeDefaultNotes
childrenReactNode-Optional custom divider content; default is a rule.
classNamestring-Additional styles.

FloatingControlsSlot

PropTypeDefaultNotes
childrenReactNode-Freeform slot for custom controls.
classNamestring-Additional styles.

FloatingControlsItemEntry

Declarative item shape in the items array. Maps to FloatingControlsItem. Also accepts onClick, disabled, className, and aria-label.

PropTypeDefaultNotes
type"item"-Optional. Omit or set item for a control entry.
keystring-Optional React key.
labelReactNode-Entry label. Used when children is omitted.
childrenReactNode-Entry label content. Wins over label when both are set.
leadingReactNode-Leading icon or mark.
trailingReactNode-Trailing icon or mark.
tone"ghost" | "solid"-Item emphasis.

FloatingControlsDividerEntry

PropTypeDefaultNotes
type"divider"-Marks a divider entry (required).
childrenReactNode-Optional custom divider content.

FloatingControlsSlotEntry

PropTypeDefaultNotes
type"slot"-Marks a slot entry (required).
childrenReactNode-Slot content (required).

Keyboard and accessibility

Toolbar items share one tab stop. Arrow keys move focus between enabled FloatingControlsItem hosts. Home and End jump to the ends.

Tokens

Theme defaults live on :root. Override these globally or on a local host.

TokenTypeDefaultNotes
--df-floating-controls-paddingCSS lengthvar(--df-floating-controls-padding-default)Active bar inset. Resolved from the padding prop scale.
--df-floating-controls-radiusCSS lengthvar(--radius-xl)Active bar corner radius. Resolved from the radius prop.
--df-floating-controls-padding-noneCSS length0Bar inset for padding none.
--df-floating-controls-padding-smCSS lengthcalc(0.5 * var(--spacing-unit))Bar inset for padding sm.
--df-floating-controls-padding-defaultCSS lengthcalc(1 * var(--spacing-unit))Bar inset for padding default.
--df-floating-controls-padding-lgCSS lengthcalc(1.5 * var(--spacing-unit))Bar inset for padding lg.
--df-floating-controls-padding-2xlCSS lengthcalc(2 * var(--spacing-unit))Bar inset for padding 2xl.
--overlay-bgCSS colorcolor-mix(in oklch, black 50%, transparent)Bar fill on the overlay variant.
--overlay-fgCSS colorcolor-mix(in oklch, white 88%, transparent)Bar label color on the overlay variant.
--overlay-borderCSS colorcolor-mix(in oklch, white 10%, transparent)Bar border on the overlay variant.
--overlay-shadowCSS shadowvar(--df-shadow-overlay)Bar shadow on the overlay variant.
--overlay-blurCSS lengthvar(--df-blur-overlay)Backdrop blur on the overlay variant.
--overlay-item-fgCSS colorcolor-mix(in oklch, white 82%, transparent)Item label color at rest.
--overlay-item-fg-activeCSS colorwhiteItem label color when active.
--overlay-item-hover-bgCSS colorcolor-mix(in oklch, white 10%, transparent)Item fill on hover.
--overlay-item-on-bgCSS colorcolor-mix(in oklch, white 12%, transparent)Item fill when toggled on.
--overlay-solid-bgCSS colorwhiteBar fill on the surface variant.
--overlay-solid-fgCSS coloroklch(0.2 0 0)Bar label color on the surface variant.
--overlay-solid-hover-bgCSS colorcolor-mix(in oklch, white 88%, oklch(0.85 0 0))Item fill on hover for the surface variant.
--overlay-dividerCSS colorcolor-mix(in oklch, white 15%, transparent)Divider color between items.
--df-label-line-heightCSS line-heightvar(--df-leading-none)Line box for label flex centering. Defaults to --df-leading-none. When text-box is unavailable and the cap unit is supported, the kit sets this to 1cap so flex centering matches cap-height ink.