Action Bar

A bar that appears at the bottom of the screen with actions for the items a user has selected.

Usage

Code
import { ActionBar } from '@leverui/components';
Code
<ActionBar.Root>
  <ActionBar.Positioner>
    <ActionBar.Content aria-label="Selection actions">
      <ActionBar.CloseTrigger />
      <ActionBar.SelectionTrigger />
      <ActionBar.Separator />
    </ActionBar.Content>
  </ActionBar.Positioner>
</ActionBar.Root>

Examples

Close Trigger

Render ActionBar.CloseTrigger to close the action bar, and pass onOpenChange to control its visibility. The open and onOpenChange props control the bar together.

Within Dialog

Compose the ActionBar and Dialog to perform a delete action on selected items. Press Delete projects to open the dialog.

Placement

Use placement to position the action bar at bottom (default), bottom-start, or bottom-end.

Placement:

Props

Root

PropDefaultTypeDescription
placement'bottom''bottom' | 'bottom-start' | 'bottom-end' or responsive valuesPosition along the bottom of the screen.
open—booleanOpen state, when you control it.
defaultOpen—booleanStart open, when uncontrolled.
onOpenChange—(details: ActionBarOpenChangeDetails) => voidCalled when the bar opens or closes.
closeOnEscapetruebooleanClose on Escape.
closeOnInteractOutsidetruebooleanClose on click or focus outside.
autoFocusfalsebooleanFocus the first focusable item on open.
restoreFocustruebooleanReturn focus to where it was on close.
lazyMounttruebooleanRender the bar only once it first opens.
unmountOnExittruebooleanRemove the bar after its closing transition.
modalfalsebooleanBlock the page and trap focus while open.
unstyledfalsebooleanTurn off the Lever UI styles.
finalFocusEl—() => Element | nullReturns the element to focus after close.
initialFocusEl—() => HTMLElement | null | falseReturns the element to focus on open. false skips focus.
id—stringUnique ID.
ids—Object of part IDsYour own part IDs, replacing the generated ones.
immediate—booleanApply show and hide changes right away.
onEscapeKeyDown—(event: KeyboardEvent) => voidCalled on Escape.
onFocusOutside—(event: FocusOutsideEvent) => voidCalled when focus moves outside the bar.
onInteractOutside—(event: InteractOutsideEvent) => voidCalled on click or focus outside the bar.
onPointerDownOutside—(event: PointerDownOutsideEvent) => voidCalled on pointer down outside the bar.
onRequestDismiss—(event: LayerDismissEvent) => voidCalled when a parent layer asks the bar to close.
onExitComplete—() => voidCalled after the closing transition ends.
persistentElements—Array<() => Element | null>Outside elements that stay usable while open.
present—booleanRendered state, when you control it.
skipAnimationOnMountfalsebooleanSkip the opening animation on first mount.
translations—IntlTranslationsTranslated text for screen readers.

ActionBar.Root behaves like Popover.

Custom layouts: ActionBar.RootProvider, ActionBar.PropsProvider, ActionBar.Context, useActionBarContext.

Styling: pass class, set variables such as --leverui-action-bar-offset, or target the stable leverui-action-bar__* classes.