Skip to main content

React Components

@launchmystore/app-bridge-react ships two kinds of components:
  1. Chrome wrappers<TitleBar />, <NavigationMenu />, <Loading />. These render nothing visible. They render to the host chrome by calling the matching App Bridge action under the hood.
  2. In-iframe UI primitives<AdminBlock>, <AdminAction>, <AdminPrintAction>, layout/text/form primitives. These render inside your extension iframe and give you a consistent look without pulling in a separate design system.
All components require an <AppBridgeProvider> ancestor — see React Hooks.

Chrome wrappers

These are declarative shells around their matching hooks. They return null and re-render the host chrome whenever their props change. Use them when you’d rather think in JSX than in imperative .update() calls.

<TitleBar />

Sets the admin page title, primary/secondary action buttons, and breadcrumbs. Wraps useTitleBar.
Props (TitleBarProps) Re-renders trigger an update() on the underlying action — flip loading: true on the primary action to show a spinner without re-creating the bar.

<NavigationMenu />

Registers a left-rail navigation menu for the app’s admin pages. Wraps useNavigationMenu.
Props (NavigationMenuProps) The host swallows the click and fires this callback — you’re responsible for the in-iframe route change (e.g. router.push(url)).

<Loading />

Toggles the global loading bar in the host chrome (the thin progress strip at the top of the admin). Wraps useLoading.
Props (LoadingProps)

Contextual save bar

There’s no <ContextualSaveBar /> component — the save bar’s imperative API (setSaveLoading, setDiscardLoading) is a poor fit for declarative JSX. Use the useContextualSaveBar or useDirtyState hooks instead:

Admin extension containers

Use these as the outermost element of any extension iframe. They give you a card / modal / print layout that matches the host admin look without you having to import a design system.

<AdminBlock>

Outer container for block extension targets (product.details.block, order.details.block, etc.). Renders a white card with a title and padding.
Props (AdminBlockProps)title?: string, padding?: number (default 16), plus any HTMLDivElement attributes.

<AdminAction>

Container for modal-style action extension targets (admin.order-details.action.render, etc.). Renders a scrolling body with a sticky footer containing the primary + secondary action buttons. The footer handles button states (loading / destructive / disabled) for you.
Props (AdminActionProps)
  • primaryAction?: { content, onAction?, loading?, destructive?, disabled? }
  • secondaryActions?: Array<{ content, onAction?, disabled? }>
  • Plus any HTMLDivElement attributes.

<AdminPrintAction>

Container for print extension targets (admin.order-details.print.render). Renders a full-page print layout with @media print rules that reset margins and colors. Use usePrintReady() from inside the tree to signal the host that the content has finished loading and can be sent to the printer.
The host inspects data-print-ready="true" on the container and only then calls the browser print dialog.

Layout primitives

Token-driven flex layouts. Gaps use the spacing scale "0" | "100" | "200" | "300" | "400" | "500" (= 0 | 4 | 8 | 12 | 16 | 24 px).

Typography

Display

Form

Controlled inputs. All call onChange(value) with the next value (no event object). All accept label, helpText, error.

Design tokens

All components read from a shared token set exported by @launchmystore/app-bridge-react:
  • tokens.color.* — base, surface, border, primary, critical, success, info, warning, plus *Subdued / *Border variants for banners.
  • tokens.font.*family, size.{xs,sm,md,lg,xl}, weight.*, lineHeight.*.
  • tokens.radius.*sm (4), md (6), lg (8).
  • tokens.shadow.*sm for cards.
You can override per-component via the standard style prop — the token style is spread first, your style last.

When to use components vs. hooks

Both styles use the same wire protocol — pick whichever reads better in the component you’re writing.

See Also

  • React Hooks — every hook the components wrap, plus the data-fetching / cart / lifecycle hooks that have no component equivalent.
  • Actions Reference — raw payload shapes for every App Bridge action.
  • App Bridge Overview — the iframe ↔ host postMessage contract underneath all of this.