Action Bar
A floating bulk-action toolbar that appears above the page when items are selected.
1234567891011121314151617181920import { ActionBar } from "#components/ui/ui-sdk/action-bar.tsx";import { Button } from "#components/ui/ui-sdk/button.tsx";
export function Example({ selection }: { selection: string[] }) { if (selection.length === 0) return null; return ( // the positioner fixes the bar over the viewport bottom, above the page — // render it only while a selection exists; parts compose via render <ActionBar.Positioner> <ActionBar.Content> <ActionBar.SelectionTrigger> {selection.length} selected </ActionBar.SelectionTrigger> <ActionBar.Separator /> <Button variant="ghost" size="xs">Download</Button> <Button variant="ghost" size="xs">Delete</Button> </ActionBar.Content> </ActionBar.Positioner> );}Install
1npx stylexblocks add action-barSource
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120import * as stylex from "@stylexjs/stylex";import { createSlotRecipeContext } from "#lib/ui-sdk/create-slot-recipe-context.tsx";import { defineSlotRecipe } from "#lib/recipe-props.ts";import { zIndices } from "@stylexblocks/ui/tokens/z-indices.stylex.ts";import { fontSizes } from '@stylexblocks/ui/tokens/font-sizes.stylex.ts'import { lineHeights } from '@stylexblocks/ui/tokens/line-heights.stylex.ts'import { semanticColors } from '@stylexblocks/ui/semantic-tokens/colors.stylex.ts'import { semanticRadii } from '@stylexblocks/ui/semantic-tokens/radii.stylex.ts'import { semanticShadows } from '@stylexblocks/ui/semantic-tokens/shadows.stylex.ts'import { sizes } from '@stylexblocks/ui/tokens/sizes.stylex.ts'import { spacing } from '@stylexblocks/ui/tokens/spacing.stylex.ts'
const actionBarPositioner = stylex.create({ base: { position: 'fixed', display: 'flex', justifyContent: 'center', pointerEvents: 'none', insetInline: 0, top: 'unset', bottom: 'calc(env(safe-area-inset-bottom) + 20px)', },})
const actionBarContent = stylex.create({ base: { backgroundColor: semanticColors.bgPanel, boxShadow: semanticShadows.md, display: 'flex', alignItems: 'center', gap: spacing._3, borderRadius: semanticRadii.panel, paddingBlock: spacing._2_5, paddingInline: spacing._3, pointerEvents: 'auto', translate: 'calc(-1 * var(--scrollbar-width) / 2) 0px', },})
const actionBarSeparator = stylex.create({ base: { width: '1px', height: sizes._5, backgroundColor: semanticColors.border, },})
const actionBarSelectionTrigger = stylex.create({ base: { display: 'inline-flex', alignItems: 'center', gap: spacing._2, alignSelf: 'stretch', fontSize: fontSizes.sm, lineHeight: lineHeights.sm, paddingInline: spacing._4, paddingBlock: spacing._1, borderRadius: semanticRadii.control, borderWidth: '1px', borderStyle: 'dashed', },})
// defineSlotRecipe validates the shape at compile time: default values must// exist in the axis maps, and slot keys must be `styles` or a declared axisconst actionBarRecipe = defineSlotRecipe({ slots: { positioner: { styles: actionBarPositioner }, content: { styles: actionBarContent }, separator: { styles: actionBarSeparator }, selectionTrigger: { styles: actionBarSelectionTrigger }, }, defaultVariants: {},});
// Local chrome the recipe leaves to the composition layer: a z-index so the// fixed bar floats above sticky page chrome, a hairline on the panel, and// the selection chip's dashed border color.const chrome = stylex.create({ positioner: { zIndex: zIndices.dropdown, }, content: { borderWidth: "1px", borderStyle: "solid", borderColor: semanticColors.border, }, selectionTrigger: { borderColor: semanticColors.border, color: semanticColors.fgMuted, },});
/** * Action Bar — a floating bulk-action toolbar composed from presentational * parts: the positioner fixes itself over the viewport bottom (render it * only while a selection exists), the content is the floating panel. Every * part composes via `render` through UI SDK's `renderElement`. */const { withProvider, withContext } = createSlotRecipeContext(actionBarRecipe);
export const ActionBar = { Positioner: withProvider( "div", () => [actionBarPositioner.base, chrome.positioner], "ActionBarPositioner", ), Content: withContext( "div", () => [actionBarContent.base, chrome.content], "ActionBarContent", ), SelectionTrigger: withContext( "span", () => [actionBarSelectionTrigger.base, chrome.selectionTrigger], "ActionBarSelectionTrigger", ), Separator: withContext("div", "separator", "ActionBarSeparator"),};
Examples
Installable blocks built with Action Bar — real use cases, delivered as source you own.
Two-pane resizable partner support and security triage queue pairing an adaptive container-query inbox table—with folder scope controls, search, bulk selection ActionBar, unread indicators, star toggles, and hover quick-actions—with a collapsible message thread reader and live reply / internal-note composer.
Full-page searchable subscriptions and invoices ledger with billing-cycle scope control, status and plan filters, column sorting, multi-row selection with a floating ActionBar, per-row menus, pagination, empty state, and live filtered totals.
Multi-section workspace settings layout with grouped sidebar navigation, responsive mobile tabs, a sticky dirty-state save bar, API token management, session controls, and team billing quotas.
Focused Cinder Cloud API keys and service tokens table with environment segment filter, status select, live search, sortable column headers, multi-row selection with a contextual floating ActionBar, per-row overflow menus, create-token dialog, destructive confirmation AlertDialog, pagination, and empty state.
Hierarchical work breakdown and cost rollup tree table with multi-level expand/collapse, visual tree guide lines, live parent rollups, hierarchical indeterminate selection, ancestor-preserving search and health filters, in-place sibling sorting, keyboard treegrid navigation, a floating bulk ActionBar, and a node inspector Drawer.