npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@molecule/app-ui-react

v4.15.2

Published

React UI primitive bundle for molecule.dev — Button, Modal, Tooltip, Toast, Alert, Card, Badge, Avatar, Tabs, Accordion, Dropdown, Select, Checkbox, Switch, Input, Table, Spinner, Skeleton, Progress and more. Import these primitives; do not rebuild them.

Readme

@molecule/app-ui-react

React UI components for molecule.dev.

Provides React implementations of the @molecule/app-ui component interfaces using the UIClassMap abstraction from @molecule/app-ui.

Form awaits onFormSubmit(data) or onSubmit (including a useForm().handleSubmit handler), disables its fieldset while pending, and renders rejected submissions as an accessible error list. Auth body, HTTP response.data, data.errors and ordinary errors are supported; entered values stay in place for retry. Handlers that catch their own failure can pass submitError={formState.submitError}. Key the form by record when switching records so an old pending submit cannot affect the new form.

Server-backed boolean actions use OptimisticToggleButton: pass a loaded value, a commit(desired) returning the confirmed boolean, and translated activeLabel and inactiveLabel. The label and pressed state change on the first tap; saves run in order and the newest failure rolls back. Mount after the initial record loads, key by record, and keep it mounted during refetches. Authorization and self-record checks stay in the app. Each label names the complete action, including its target when useful: for a document, inactiveLabel="Favorite document" and activeLabel="Unfavorite document". A static target label such as "document" does not tell the person which action the button performs. Count-only/icon controls can pass their own React nodes and accessible labels. For a POST/DELETE relationship, createQueryResource().toggle(viewer, id, action, desired) from @molecule/app-query supplies the request direction; return the saved flag from commit. A local menu or panel uses Button/Switch with local state and no server commit.

Auto-generated, AI-first package reference for the molecule.dev ecosystem. It is written to be read by coding agents as much as by people, and is generated from this package's source — edit src/index.ts JSDoc, not this file.

Quick Start

import { setClassMap } from '@molecule/app-ui'
import { classMap } from '@molecule/app-ui-tailwind'
import { Button, Modal, Icon, EmptyState } from '@molecule/app-ui-react'
import { useState } from 'react'

// Once at startup, before first render — components throw without it:
setClassMap(classMap)

function ConfirmDelete({ onConfirm }: { onConfirm: () => void }) {
  const [open, setOpen] = useState(false)
  return (
    <>
      <Button color="error" onClick={() => setOpen(true)}>
        <Icon name="trash" size={16} /> Delete
      </Button>
      <Modal
        open={open}
        onClose={() => setOpen(false)}
        title="Delete item?"
        data-mol-id="confirm-delete"
      >
        <EmptyState title="This cannot be undone" />
        <Button color="error" onClick={onConfirm}>
          Confirm
        </Button>
      </Modal>
    </>
  )
}

Type

framework

Installation

npm install @molecule/app-ui-react @molecule/app-filesystem @molecule/app-i18n @molecule/app-icons @molecule/app-inline-style-dom @molecule/app-overlay-dom @molecule/app-pointer-events-dom @molecule/app-react @molecule/app-react-ui-kit-components @molecule/app-ui react react-dom
npm install -D @types/react @types/react-dom

API

Interfaces

KitFieldChangeEvent

Both targets expose the field's string value during the callback.

interface KitFieldChangeEvent extends KitEvent {
  /** The edited field, or its value snapshot on a device. */
  readonly target: EventTarget & { value: string }
  /** The field handling the change. */
  readonly currentTarget: KitFieldChangeEvent['target']
}

CSSProperties

Framework-agnostic CSS properties. Mirrors React.CSSProperties but without React dependency.

interface CSSProperties {
  [key: string]: string | number | undefined
}

KitEvent

The event a web UI kit hands a component's handler: the members shared by the web kits. React's kit passes React's event (so stopPropagation() stops React parent handlers), the other web kits pass the DOM event; both satisfy this type. A handler that needs a member only one of them has (nativeEvent, composedPath(), isComposing) takes the component's ref element (see {@link BaseProps}) and listens on it.

type is left out on purpose: kits report different event types for the same moment (a text field's onChange is React's 'change' and the DOM's 'input').

interface KitEvent {
  /** The element the event started on. */
  readonly target: EventTarget | null
  /** The element of the component the handler was passed to. */
  readonly currentTarget: EventTarget | null
  /** Whether a handler already called {@link KitEvent.preventDefault}. */
  readonly defaultPrevented: boolean
  /** Cancels the browser's default action (a form's submit, a checkbox's toggle). */
  preventDefault(): void
  /** Stops handlers of ancestor components of the same kit. */
  stopPropagation(): void
}

KitModifierKeys

The modifier keys held during a mouse or keyboard event.

interface KitModifierKeys {
  /** Alt (Option) was held. */
  readonly altKey: boolean
  /** Control was held. */
  readonly ctrlKey: boolean
  /** Meta (Command, Windows) was held. */
  readonly metaKey: boolean
  /** Shift was held. */
  readonly shiftKey: boolean
}

KitMouseEvent

A mouse event as every kit hands it to a handler.

interface KitMouseEvent extends KitEvent, KitModifierKeys {
  /** The button that changed state (0 main, 1 auxiliary, 2 secondary). */
  readonly button: number
  /** The buttons held, as a bit mask. */
  readonly buttons: number
  /** The pointer's x position in the viewport. */
  readonly clientX: number
  /** The pointer's y position in the viewport. */
  readonly clientY: number
  /** The pointer's x position in the document. */
  readonly pageX: number
  /** The pointer's y position in the document. */
  readonly pageY: number
  /** The click count of a click event. */
  readonly detail: number
  /** The element the pointer came from or went to, for enter and leave events. */
  readonly relatedTarget: EventTarget | null
}

KitKeyboardEvent

A keyboard event as every kit hands it to a handler.

interface KitKeyboardEvent extends KitEvent, KitModifierKeys {
  /** The key's value (`'Enter'`, `'a'`). */
  readonly key: string
  /** The physical key (`'KeyA'`). */
  readonly code: string
  /** Whether the key is held down and auto-repeating. */
  readonly repeat: boolean
}

KitFocusEvent

A focus event as every kit hands it to a handler.

interface KitFocusEvent extends KitEvent {
  /** The element losing focus (on focus) or gaining it (on blur). */
  readonly relatedTarget: EventTarget | null
}

BaseProps

Base props shared by all components.

Ref element: a component that renders one main element gives the caller that element, the one that takes className and style. Each UI kit hands it over in its framework's own way: React and Solid a ref, Vue a template ref's $el, Svelte bind:ref, Angular the component's element() signal. It is empty while the element is not rendered (a closed Tooltip, Dropdown or Modal). A component's own doc names the element when it is not the outermost one.

interface BaseProps {
  /**
   * Additional CSS class name(s).
   */
  className?: string

  /**
   * Inline styles.
   */
  style?: CSSProperties

  /**
   * Test ID for automated testing.
   */
  testId?: string

  /**
   * Automation ID for AI agents and E2E tests. Maps to the `data-mol-id`
   * HTML attribute. Use `molId()` from `./automation.js` to generate
   * semantic IDs. (Tooling only — screen readers do not expose `data-*`
   * attributes; accessible names come from labels/`aria-*`.)
   */
  automationId?: string

  /**
   * Disables the controls the component renders: a disabled Button, Input, Textarea, Select,
   * Checkbox, Switch, RadioGroup, Tabs, Accordion or Pagination takes no input, a disabled
   * Dropdown never opens, and a disabled Card never calls `onClick` (an interactive one is
   * announced as disabled and leaves the tab order). A component that renders no control
   * (Badge, Spinner, Skeleton, a layout box) ignores it.
   */
  disabled?: boolean
}

HTMLElementProps

Base props for HTML elements. Framework bindings should extend this with framework-specific attributes.

interface HTMLElementProps extends BaseProps, Pick<ElementProps, 'lang'> {
  id?: string
  title?: string
  tabIndex?: number
  role?: ElementRole
  'aria-label'?: string
  'aria-labelledby'?: string
  'aria-describedby'?: string
  'aria-hidden'?: boolean
  'aria-disabled'?: boolean
  'aria-expanded'?: boolean
  'aria-selected'?: boolean
  'aria-checked'?: boolean | 'mixed'
  'aria-pressed'?: boolean | 'mixed'
  'aria-invalid'?: boolean
  'aria-required'?: boolean
  'aria-readonly'?: boolean
  'aria-busy'?: boolean
  'aria-live'?: 'off' | 'polite' | 'assertive'
  onClick?: MouseEventHandler
  onDoubleClick?: MouseEventHandler
  onMouseEnter?: MouseEventHandler
  onMouseLeave?: MouseEventHandler
  onFocus?: FocusEventHandler
  onBlur?: FocusEventHandler
  onKeyDown?: KeyboardEventHandler
  onKeyUp?: KeyboardEventHandler
  onKeyPress?: KeyboardEventHandler
}

InputElementProps

Base props for input elements.

interface InputElementProps extends HTMLElementProps {
  name?: string
  value?: string | number | readonly string[]
  defaultValue?: string | number | readonly string[]
  placeholder?: string
  required?: boolean
  readOnly?: boolean
  autoFocus?: boolean
  autoComplete?: string
  maxLength?: number
  minLength?: number
  pattern?: string
  /** Web change event. Prefer the control's value callback for shared web and native code. */
  onChange?: ChangeEventHandler
  onInput?: FormEventHandler
}

ButtonElementProps

Base props for button elements.

interface ButtonElementProps extends HTMLElementProps {
  /**
   * Defaults to `'button'` in every framework binding, so a button never submits a
   * form by accident. A form's primary action must set `type="submit"`: Enter then
   * submits the form, and tests that select `button[type="submit"]` find it.
   */
  type?: 'button' | 'submit' | 'reset'
  name?: string
  value?: string
  form?: string
}

TextareaElementProps

Base props for textarea elements.

interface TextareaElementProps extends HTMLElementProps {
  name?: string
  value?: string
  defaultValue?: string
  placeholder?: string
  required?: boolean
  readOnly?: boolean
  autoFocus?: boolean
  rows?: number
  cols?: number
  maxLength?: number
  minLength?: number
  wrap?: 'hard' | 'soft' | 'off'
  /** Web change event. {@link TextareaProps.onValueChange} also works on native. */
  onChange?: EventHandler<KitFieldChangeEvent>
  onInput?: FormEventHandler
}

SelectElementProps

Base props for select elements.

interface SelectElementProps extends HTMLElementProps {
  name?: string
  required?: boolean
  autoFocus?: boolean
  multiple?: boolean
  /** Web change event. {@link SelectProps.onValueChange} also works on native. */
  onChange?: EventHandler<KitFieldChangeEvent>
}

FormElementProps

Base props for form elements.

interface FormElementProps extends HTMLElementProps {
  action?: string
  method?: 'get' | 'post'
  encType?: string
  target?: string
  noValidate?: boolean
  autoComplete?: 'on' | 'off'
  onSubmit?: FormEventHandler
  onReset?: FormEventHandler
}

TextareaProps

Props for the Textarea component.

Ref element: the native <textarea>.

interface TextareaProps extends TextareaElementProps, Pick<TextFieldProps, 'onValueChange'> {
  /**
   * Text size tier (see {@link TextareaClassOptions.size}) — pass the same
   * `size` as a neighboring Input for identical font sizes.
   */
  size?: Size

  /**
   * Label text.
   */
  label?: string

  /**
   * Error message.
   */
  error?: string

  /**
   * Hint/help text.
   */
  hint?: string

  /**
   * Whether the textarea auto-resizes.
   */
  autoResize?: boolean

  /**
   * Minimum number of rows.
   */
  minRows?: number

  /**
   * Maximum number of rows.
   */
  maxRows?: number
}

SelectOption

A single option in a Select dropdown.

interface SelectOption<T = string> {
  /**
   * Option value.
   */
  value: T

  /**
   * Display label.
   */
  label: string

  /**
   * Whether the option is disabled.
   */
  disabled?: boolean

  /**
   * Option group (for grouped selects).
   */
  group?: string
}

SelectProps

Props for the Select dropdown component (single or multi-select).

Ref element: the native <select>.

interface SelectProps<T = string> extends SelectElementProps {
  /**
   * Select options.
   */
  options: SelectOption<T>[]

  /**
   * Current value.
   */
  value?: T

  /**
   * Called with the selected value on web and native.
   */
  onValueChange?: (value: T) => void

  /**
   * Select size.
   */
  size?: Size

  /**
   * Label text.
   */
  label?: string

  /**
   * Placeholder text.
   */
  placeholder?: string

  /**
   * Error message.
   */
  error?: string

  /**
   * Hint/help text.
   */
  hint?: string

  /**
   * Whether to allow clearing the selection.
   */
  clearable?: boolean
}

CheckboxProps

Props for the Checkbox component.

Ref element: the native <input type="checkbox">.

interface CheckboxProps extends InputElementProps, Pick<CheckFieldProps, 'onCheckedChange'> {
  /**
   * Checkbox label.
   */
  label?: Children

  /**
   * Whether the checkbox is checked.
   */
  checked?: boolean

  /**
   * Whether the checkbox is in an indeterminate state.
   */
  indeterminate?: boolean

  /**
   * Checkbox size.
   */
  size?: Size

  /**
   * Error message.
   */
  error?: string
}

RadioOption

A single option in a RadioGroup.

interface RadioOption<T = string> {
  /**
   * Option value.
   */
  value: T

  /**
   * Display label.
   */
  label: Children

  /**
   * Whether the option is disabled.
   */
  disabled?: boolean
}

RadioGroupProps

Props for the RadioGroup component.

interface RadioGroupProps<T = string> extends BaseProps {
  /**
   * Radio options.
   */
  options: RadioOption<T>[]

  /**
   * Current value.
   */
  value?: T

  /**
   * Change handler.
   */
  onChange?: (value: T) => void

  /**
   * Radio size.
   */
  size?: Size

  /**
   * Group label.
   */
  label?: string

  /**
   * Shared `name` attribute for the group's radio inputs (used for native
   * form submission). When omitted, a unique per-instance name is generated
   * so separate groups never merge — the visible `label` is deliberately
   * NOT used as the name, because two groups with the same label (e.g. two
   * "Size" pickers) would otherwise form ONE native radio group and
   * deselect each other.
   */
  name?: string

  /**
   * Layout direction.
   */
  direction?: 'horizontal' | 'vertical'

  /**
   * Error message.
   */
  error?: string
}

SwitchProps

Props for the Switch/Toggle component.

Ref element: the role="switch" button.

interface SwitchProps extends InputElementProps, Pick<CheckFieldProps, 'onCheckedChange'> {
  /**
   * Switch label.
   */
  label?: Children

  /**
   * Whether the switch is on.
   */
  checked?: boolean

  /**
   * Switch size.
   */
  size?: Size

  /**
   * Color when on.
   */
  color?: ColorVariant
}

ModalProps

Props for the Modal/Dialog component.

Ref element: the dialog (role="dialog"), empty while closed.

interface ModalProps extends HTMLElementProps {
  /**
   * Whether the modal is open.
   */
  open: boolean

  /**
   * Called when the modal should close.
   */
  onClose: () => void

  /**
   * Modal title.
   */
  title?: string

  /**
   * Modal content.
   */
  children?: Children

  /**
   * Modal size.
   */
  size?: ModalSize

  /**
   * Whether to show a close button.
   */
  showCloseButton?: boolean

  /**
   * Whether clicking the overlay closes the modal.
   */
  closeOnOverlayClick?: boolean

  /**
   * Whether pressing Escape closes the modal.
   */
  closeOnEscape?: boolean

  /**
   * Footer content (typically action buttons).
   */
  footer?: Children

  /**
   * Whether the modal is centered vertically.
   */
  centered?: boolean

  /**
   * Whether to prevent body scroll when open.
   */
  preventScroll?: boolean

  /**
   * Accessible label for the close button.
   * @default 'Close'
   */
  closeLabel?: string

  /**
   * The control that takes focus when the modal opens, such as the field a dialog exists to fill.
   * Without it, focus goes to the first focusable control, or to the dialog when it has none. The
   * modal reads it once the open dialog is in the document, so a control rendered in the
   * children can be named here.
   */
  initialFocus?: OverlayTarget
}

SpinnerProps

Props for the Spinner/loading indicator component.

interface SpinnerProps extends BaseProps {
  /**
   * Spinner size.
   */
  size?: Size

  /**
   * Spinner color.
   */
  color?: ColorVariant | string

  /**
   * Loading label (for accessibility).
   */
  label?: string

  /**
   * Spinner thickness.
   */
  thickness?: number
}

AvatarProps

Props for the Avatar component.

interface AvatarProps extends HTMLElementProps {
  /**
   * Image source URL.
   */
  src?: string

  /**
   * Alt text for the image.
   */
  alt?: string

  /**
   * Name for fallback initials.
   */
  name?: string

  /**
   * Avatar size.
   */
  size?: Size | number

  /**
   * Whether the avatar is rounded.
   */
  rounded?: boolean

  /**
   * Fallback element when no image.
   */
  fallback?: Children
}

SpacerProps

Props for the Spacer layout component (adds whitespace between elements).

interface SpacerProps extends BaseProps {
  /**
   * Space size.
   */
  size?: Size | string | number

  /**
   * Whether the spacer is horizontal.
   */
  horizontal?: boolean
}

AlertProps

Props for the Alert component.

interface AlertProps extends HTMLElementProps {
  /**
   * Alert content.
   */
  children?: Children

  /**
   * Alert title.
   */
  title?: string

  /**
   * Alert status/type.
   */
  status?: ColorVariant

  /**
   * Alert variant.
   */
  variant?: 'solid' | 'subtle' | 'outline' | 'left-accent'

  /**
   * Whether the alert is dismissible.
   */
  dismissible?: boolean

  /**
   * Called when dismissed.
   */
  onDismiss?: () => void

  /**
   * Icon to display.
   */
  icon?: Children

  /**
   * Accessible label for the dismiss button.
   * @default 'Dismiss'
   */
  dismissLabel?: string
}

TabItem

A single tab in a Tabs component.

interface TabItem<T = string> {
  /**
   * Tab value/id.
   */
  value: T

  /**
   * Tab label.
   */
  label: Children

  /**
   * Tab content.
   */
  content?: Children

  /**
   * Whether the tab is disabled.
   */
  disabled?: boolean

  /**
   * Icon to display.
   */
  icon?: Children
}

TabsProps

Props for the Tabs component (switchable tabbed content panels).

interface TabsProps<T = string> extends BaseProps {
  /**
   * Tab items.
   */
  items: TabItem<T>[]

  /**
   * Current active tab.
   */
  value?: T

  /**
   * Default active tab.
   */
  defaultValue?: T

  /**
   * Change handler.
   */
  onChange?: (value: T) => void

  /**
   * Tab variant.
   */
  variant?: 'line' | 'enclosed' | 'soft-rounded' | 'solid-rounded'

  /**
   * Tab size.
   */
  size?: Size

  /**
   * Whether tabs are fitted (take full width).
   */
  fitted?: boolean
}

AccordionItem

A single item in an Accordion component.

interface AccordionItem<T = string> {
  /**
   * Item value/id.
   */
  value: T

  /**
   * Item header/trigger.
   */
  header: Children

  /**
   * Item content.
   */
  content: Children

  /**
   * Whether the item is disabled.
   */
  disabled?: boolean
}

AccordionProps

Props for the Accordion component.

interface AccordionProps<T = string> extends BaseProps {
  /**
   * Accordion items.
   */
  items: AccordionItem<T>[]

  /**
   * Expanded item(s).
   */
  value?: T | T[]

  /**
   * Default expanded item(s).
   */
  defaultValue?: T | T[]

  /**
   * Change handler.
   */
  onChange?: (value: T | T[]) => void

  /**
   * Whether multiple items can be expanded.
   */
  multiple?: boolean

  /**
   * Whether items can be collapsed.
   */
  collapsible?: boolean
}

TableColumn

Table column definition.

interface TableColumn<T> {
  /**
   * Column key (data property).
   */
  key: keyof T | string

  /**
   * Column header.
   */
  header: Children

  /**
   * Custom cell renderer.
   */
  render?: (value: unknown, row: T, index: number) => Children

  /**
   * Column width.
   */
  width?: string | number

  /**
   * Whether the column is sortable.
   */
  sortable?: boolean

  /**
   * Text alignment.
   */
  align?: 'left' | 'center' | 'right'
}

TableProps

Props for the Table component.

Ref element: the <table>.

interface TableProps<T> extends HTMLElementProps {
  /**
   * Table data.
   */
  data: T[]

  /**
   * Column definitions.
   */
  columns: TableColumn<T>[]

  /**
   * Row key extractor.
   */
  rowKey?: keyof T | ((row: T) => string | number)

  /**
   * Whether to show borders.
   */
  bordered?: boolean

  /**
   * Whether rows are striped.
   */
  striped?: boolean

  /**
   * Whether rows are hoverable.
   */
  hoverable?: boolean

  /**
   * Table size.
   */
  size?: Size

  /**
   * Empty state content.
   */
  emptyContent?: Children

  /**
   * Loading state.
   */
  loading?: boolean

  /**
   * Sort configuration.
   */
  sort?: { key: string; direction: 'asc' | 'desc' }

  /**
   * Sort change handler.
   */
  onSort?: (key: string, direction: 'asc' | 'desc') => void

  /**
   * Row click handler.
   */
  onRowClick?: (row: T, index: number) => void
}

PaginationProps

Props for the Pagination component (page navigation with current page, total, page size, and change callbacks).

interface PaginationProps extends BaseProps {
  /**
   * Current page (1-indexed).
   */
  page: number

  /**
   * Total number of pages.
   */
  totalPages: number

  /**
   * Page change handler.
   */
  onChange: (page: number) => void

  /**
   * Number of sibling pages to show.
   */
  siblings?: number

  /**
   * Number of boundary pages to show.
   */
  boundaries?: number

  /**
   * Pagination size.
   */
  size?: Size

  /**
   * Whether to show first/last buttons.
   */
  showFirstLast?: boolean

  /**
   * Whether to show previous/next buttons.
   */
  showPrevNext?: boolean

  /**
   * Accessible labels for pagination controls.
   */
  labels?: {
    nav?: string
    first?: string
    previous?: string
    next?: string
    last?: string
    goToPage?: (page: number) => string
  }
}

SkeletonProps

Props for the Skeleton loading placeholder component.

interface SkeletonProps extends BaseProps {
  /**
   * Skeleton width.
   */
  width?: string | number

  /**
   * Skeleton height.
   */
  height?: string | number

  /**
   * Whether the skeleton is circular.
   */
  circle?: boolean

  /**
   * Border radius.
   */
  borderRadius?: string | number

  /**
   * Animation type.
   */
  animation?: 'pulse' | 'wave' | 'none'
}

AuthGuardProps

Props for {@link AuthGuard}.

All props are optional — the default behavior (loading tag → redirect to /login → the routed page) matches the bare-bones guard apps were shipping locally. The props let apps customize per-call without forking the component.

interface AuthGuardProps {
  /**
   * Element rendered while `useAuth().status` is `'loading'` — no session
   * decision yet. Overrides the default
   * `<div data-mol-id="auth-guard-loading">…</div>` loading tag — pass a
   * full-page spinner or any other UI you want during the auth bootstrap window.
   */
  loadingFallback?: ReactNode
  /**
   * i18n key used for the default loading-tag text. Defaults to
   * `'common.loading'`. Ignored when `loadingFallback` is set.
   */
  loadingKey?: string
  /**
   * Fallback text if the i18n key is missing. Defaults to `'Loading...'`
   * (the project-canonical ASCII glyph — Phase C of the locale
   * canonicalization plan). Ignored when `loadingFallback` is set.
   */
  loadingDefault?: string
  /**
   * Path to redirect to when `useAuth().status` is `'unauthenticated'`.
   * Defaults to `'/login'`. The current `useLocation()` is preserved as
   * `state.from` for post-login restoration.
   */
  loginPath?: string
  /**
   * Callback invoked when `isAuthenticated` transitions to `true` (or is
   * already `true` on first render). Useful for one-shot per-app
   * bootstrap effects (e.g. seeding fixture data). The caller is
   * responsible for idempotency if the auth state can flip back and
   * forth — this fires on every transition.
   */
  onAuthenticated?: () => void
  /**
   * Children to render when authenticated. Without them the guard renders
   * `<RoutedView />`: the matched child route, through whichever routing bond
   * the app wired. That throws when the routing bond has no routed view
   * (Next.js gives a layout its page as `children`): pass the page then.
   */
  children?: ReactNode
}

ConfirmButtonProps

Props for {@link ConfirmButton}.

interface ConfirmButtonProps extends Omit<
  ButtonProps,
  'onClick' | 'children' | 'onConfirm' | keyof React.DOMAttributes<ElementHandle>
> {
  /**
   * Fired ONLY on the confirming (second) click — i.e. when the action
   * actually commits. Errors should be handled by the caller (render an
   * inline banner); while the returned promise is pending the button stays
   * in its confirming state and ignores further clicks.
   */
  onConfirm: () => void | Promise<void>
  /**
   * Visible label in the idle (armed-to-be-clicked) state.
   */
  label: React.ReactNode
  /**
   * Visible label in the armed state — the "click again to confirm" step.
   * Defaults to a localized "Confirm?" via the i18n bond.
   */
  confirmLabel?: React.ReactNode
  /**
   * Visible label while {@link onConfirm} is pending. Defaults to a
   * localized "Working…".
   */
  pendingLabel?: React.ReactNode
  /**
   * Seconds before the armed state auto-disarms back to idle. Low-stakes
   * actions tolerate a long window; destructive ones should keep it short.
   * `0` disables auto-disarm (not recommended — a stray click then leaves
   * the button armed forever).
   */
  disarmSeconds?: number
  /**
   * Disable the control entirely (idle and confirming states).
   */
  disabled?: boolean
  /**
   * data-mol-id for the button (all states share one element).
   */
  testId?: string
}

ConfirmDialogProps

Props for {@link ConfirmDialog}.

interface ConfirmDialogProps {
  /** Whether the dialog is open. */
  open: boolean
  /** Called when the dialog should close (escape, backdrop, cancel). */
  onClose: () => void
  /** Title. */
  title: ReactNode
  /** Body / warning text. */
  description: ReactNode
  /** Confirm-button label (e.g. "Delete"). */
  confirmLabel?: ReactNode
  /** Cancel-button label. */
  cancelLabel?: ReactNode
  /** Called when the user confirms. */
  onConfirm: () => void | Promise<void>
  /** Is the confirm action destructive? Defaults to true. */
  destructive?: boolean
  /** Extra body content between description and footer. */
  children?: ReactNode
  /** Disables both buttons. Set it yourself while your `onConfirm` promise is pending — the dialog does not track it and does not auto-close. */
  loading?: boolean
}

ReactFormProps

Props for the React form, including a failure managed by an external form controller.

interface ReactFormProps extends FormProps {
  /** A rejected submission, for example useForm().formState.submitError. */
  submitError?: unknown
}

IconProps

Props for {@link Icon}: the glyph, its size, and the attributes the root <svg> takes (aria-*, role, data-* and data-mol-id, paint overrides such as fill, and style).

interface IconProps extends ElementProps, Omit<SvgPaintProps, 'className'> {
  /**
   * Name of the glyph to look up in the bonded icon set. Typed as
   * {@link IconName} so a typo fails the type-check instead of throwing at
   * render time; sets with extra glyphs augment `CustomIconNames` in
   * `@molecule/app-icons` to widen it.
   */
  name: IconName
  /** Width and height of the rendered SVG in pixels. Defaults to 20. */
  size?: number
  /** Class name forwarded to the root `<svg>`. */
  className?: string
  /** CSS for the root `<svg>` on the web. */
  style?: CSSProperties
}

LanguagePickerProps

Props for {@link LanguagePicker}.

Extends the framework-agnostic button element props so callers can pass any extra data-*, aria-*, event handler, or style prop without forking the component. The named props let apps customize the trigger label, icon, size, and modal heading without spreading attribute concerns.

interface LanguagePickerProps extends Omit<
  ButtonElementProps,
  'aria-label' | 'onClick' | 'type' | 'children'
> {
  /** i18n key for the trigger button label / aria-label. Defaults to `'footer.language'`. */
  labelKey?: string
  /** Fallback label if the i18n key is missing. Defaults to `'Language'`. */
  labelDefault?: string
  /** i18n key for the modal title. Defaults to `'languagePicker.modalTitle'`. */
  modalTitleKey?: string
  /** Fallback modal title if the i18n key is missing. Defaults to `'Choose language'`. */
  modalTitleDefault?: string
  /** Icon glyph to render before the current locale name. Defaults to `'globe'`. */
  icon?: IconName
  /** Pixel size for the rendered icon. Defaults to `16`. */
  iconSize?: number
  /**
   * What to render inside the trigger button.
   *
   * - `'name'` — globe icon + current locale's native name (e.g. `🌐 English`).
   *   This is the default; matches the molecule-dev footer pattern.
   * - `'code'` — globe icon + lowercase locale code (e.g. `🌐 en`). Useful in
   *   tight chrome where the long native name (e.g. "Bahasa Indonesia") would wrap.
   * - `'icon'` — globe icon only. Useful in icon-bar headers.
   */
  display?: 'name' | 'code' | 'icon'
  /** Optional className appended to the trigger button. */
  className?: string
  /** Optional render override: receives `{ open }` and replaces the default trigger. */
  renderTrigger?: (open: () => void) => ReactNode
}

LoadErrorBannerProps

Props for {@link LoadErrorBanner}. Rest props are forwarded to the root element, so they are typed as its attributes.

interface LoadErrorBannerProps extends Omit<HTMLElementProps, 'children'> {
  /** The primary error line (e.g. the localized "Could not load X."). */
  message: React.ReactNode
  /** Secondary line under the message (status code, hint). */
  detail?: React.ReactNode
  /**
   * Called when Retry is clicked. Return the promise; while pending, the
   * button is disabled and shows "Retrying…". Omit for a display-only
   * banner.
   */
  onRetry?: () => void | Promise<void>
  /** Retry-button label. Falls back to a localized "Retry". */
  retryLabel?: React.ReactNode
  /** `data-mol-id` for the retry button (default `load-error-retry`). */
  retryMolId?: string
  /** Extra content between message and retry row (e.g. an error code). */
  children?: React.ReactNode
}

OptimisticToggleButtonProps

Props for {@link OptimisticToggleButton}. Labels come from the application's translations.

interface OptimisticToggleButtonProps extends Omit<
  ButtonProps,
  'children' | 'onClick' | 'loading' | 'loadingText' | 'type' | 'value'
> {
  /** The loaded server value. Mount the button only after its initial record exists. */
  value: boolean
  /** Saves the desired boolean and returns the server-confirmed boolean; reject on failure. */
  commit: (desired: boolean) => Promise<boolean>
  /** Label when the displayed value is true. */
  activeLabel: React.ReactNode
  /** Label when the displayed value is false. */
  inactiveLabel: React.ReactNode
  /** Receives a failed save after the controller has restored the last confirmed value. */
  onError?: (error: unknown) => void
}

PanelCloseProviderProps

Props for {@link PanelCloseProvider}.

interface PanelCloseProviderProps {
  /** Callback that dismisses the enclosing drawer/modal. */
  close: () => void
  /** Panel content that may call {@link usePanelClose}. */
  children: ReactNode
}

ProgressProps

Props for the Progress component.

interface ProgressProps extends BaseProps {
  /**
   * Progress value (0-100).
   */
  value: number

  /**
   * Maximum value.
   */
  max?: number

  /**
   * Progress size.
   */
  size?: Size

  /**
   * Progress color.
   */
  color?: ColorVariant

  /**
   * Whether to show the value label.
   */
  showValue?: boolean

  /**
   * Accessible label.
   */
  label?: string

  /**
   * Whether the progress is indeterminate.
   */
  indeterminate?: boolean
}

PromptDialogProps

Props for {@link PromptDialog}.

interface PromptDialogProps {
  /** Whether the dialog is open. */
  open: boolean
  /** Called when the dialog should close (escape, backdrop, cancel, or a fulfilled {@link PromptDialogProps.onSubmit}). */
  onClose: () => void
  /** Dialog heading. */
  title: React.ReactNode
  /** Explanatory line under the title. */
  description?: React.ReactNode
  /** Input placeholder. */
  placeholder?: string
  /** Value the input starts from every time the dialog opens. */
  initialValue?: string
  /**
   * Called with the entered value on confirm. Resolve to close the dialog;
   * reject or throw to keep it open (show the error via {@link PromptDialogProps.children}).
   */
  onSubmit: (value: string) => void | Promise<void>
  /** Confirm-button label. Falls back to a localized "Confirm". */
  confirmLabel?: React.ReactNode
  /** Cancel-button label. Falls back to a localized "Cancel". */
  cancelLabel?: React.ReactNode
  /** Render the confirm button in the error color (e.g. an irreversible reset). */
  destructive?: boolean
  /** `data-mol-id` for the text input. */
  inputMolId?: string
  /** `data-mol-id` for the confirm button. */
  confirmMolId?: string
  /** `data-mol-id` for the cancel button. */
  cancelMolId?: string
  /** Extra body content under the input (error banners, hints). */
  children?: React.ReactNode
}

ResponsiveAppShellProps

Props for the {@link ResponsiveAppShell} root.

interface ResponsiveAppShellProps {
  /**
   * The shell sub-components — `<ResponsiveAppShell.TopBar />`,
   * `<ResponsiveAppShell.Sidebar />`, `<ResponsiveAppShell.Drawer />` and
   * `<ResponsiveAppShell.Content />`.
   */
  children: ReactNode
  /**
   * Sidebar (and drawer) width: `'sm'` (208px), `'md'` (240px, default),
   * `'lg'` (256px) or an exact pixel number.
   */
  sidebarWidth?: ShellSidebarWidth
  /** Extra classes on the root flex-row container. */
  className?: string
  /**
   * `data-mol-id` for the root container. Defaults to `'shell-root'`.
   */
  dataMolId?: string
}

ResponsiveAppShellTopBarProps

Props for the {@link ResponsiveAppShellTopBar} sub-component.

interface ResponsiveAppShellTopBarProps {
  /**
   * Brand/title node, rendered after the menu trigger — typically a
   * `<Link to="/…">` with the app name or logo. The shell wraps it in a
   * flex row; style the node itself.
   */
  brand?: ReactNode
  /** Trailing actions — user menu, theme toggle, search, etc. */
  actions?: ReactNode
  /**
   * Render the top bar only below the breakpoint (mount-conditioned, not
   * CSS-hidden — no dead DOM on desktop). For apps whose desktop shell has
   * no top bar (e.g. the sidebar carries everything). Default: `false`
   * (top bar on every breakpoint).
   */
  mobileOnly?: boolean
  /** Extra classes on the `<header>`. */
  className?: string
  /** `data-mol-id` override. Default: `'shell-topbar'`. */
  dataMolId?: string
  /** `data-testid` override. */
  testId?: string
}

ResponsiveAppShellSidebarProps

Props for the {@link ResponsiveAppShellSidebar} sub-component.

interface ResponsiveAppShellSidebarProps {
  /**
   * Nav content — the links (they land inside the sidebar's `<nav>` landmark;
   * pass `aria-current="page"` from the active one yourself). Typically the
   * SAME element variable the Drawer receives, so only the mounted
   * breakpoint's copy ever instantiates.
   */
  children: ReactNode
  /**
   * Accessible name for the sidebar's `<nav>` landmark. Defaults to the
   * `appShell.primaryNav` translation (English fallback `"Primary
   * navigation"`).
   */
  navLabel?: string
  /**
   * Below-nav content (user card, quick action) — rendered after the `<nav>`
   * in a bordered footer row, so it does not sit inside the nav landmark.
   */
  footer?: ReactNode
  /** Extra classes on the `<aside>`. */
  className?: string
  /** `data-mol-id` override. Default: `'shell-sidebar'`. */
  dataMolId?: string
  /** `data-testid` override. */
  testId?: string
}

ResponsiveAppShellDrawerProps

Props for the {@link ResponsiveAppShellDrawer} sub-component.

interface ResponsiveAppShellDrawerProps {
  /**
   * Nav content — the links, same as (or adapted from) the Sidebar's. Only
   * mounted while the drawer is open on a below-breakpoint viewport.
   */
  children: ReactNode
  /**
   * Header row content (typically the brand), rendered next to the close
   * button.
   */
  header?: ReactNode
  /**
   * Accessible name for the dialog and its `<nav>` landmark. Defaults to the
   * `appShell.primaryNav` translation (English fallback `"Primary
   * navigation"`).
   */
  navLabel?: string
  /** Below-nav content (user card, sign-out), after the `<nav>`. */
  footer?: ReactNode
  /** Whether the panel shows a close (X) button. Default: `true`. */
  showCloseButton?: boolean
  /** Extra classes on the dialog panel. */
  className?: string
  /** `data-mol-id` override for the panel. Default: `'shell-drawer'`. */
  dataMolId?: string
  /** `data-mol-id` override for the close button. Default: `'shell-drawer-close'`. */
  closeDataMolId?: string
  /** `data-testid` override for the panel. */
  testId?: string
}

ResponsiveAppShellContentProps

Props for the {@link ResponsiveAppShellContent} sub-component.

interface ResponsiveAppShellContentProps {
  /** The routed page content — typically an `<Outlet />`. */
  children: ReactNode
  /** Extra classes on the `<main>`. */
  className?: string
  /** Inline styles on the `<main>` (rarely needed — layout is owned). */
  style?: React.CSSProperties
  /** `data-mol-id` override. Default: `'shell-content'`. */
  dataMolId?: string
  /** `data-testid` override. */
  testId?: string
}

SeparatorProps

Props for the Separator component.

interface SeparatorProps extends BaseProps {
  /**
   * Orientation of the separator.
   */
  orientation?: 'horizontal' | 'vertical'

  /**
   * Decorative separators are purely visual.
   */
  decorative?: boolean
}

SidebarUserCardProps

Props for the {@link SidebarUserCard} component.

Extends the framework-agnostic button element props so callers can pass extra data-*, aria-*, style, or event handler props onto the trigger button without forking. The named props below cover the common customization points.

interface SidebarUserCardProps extends Omit<
  ButtonElementProps,
  // `dataMolId` names the trigger, so the generic `automationId` is not a second way to do it.
  'aria-label' | 'onClick' | 'children' | 'automationId'
> {
  /**
   * Panel content shown inside the drawer/modal (typically the app's
   * `SettingsPanel`). It can dismiss the drawer by calling
   * `usePanelClose()` — no `onClose` prop-threading required.
   */
  children: ReactNode
  /**
   * Display name override. When omitted, falls back to
   * `useAuth().user?.name`, then `email`, then a guest label.
   */
  name?: string
  /**
   * Secondary line under the name (role, plan, status, etc.).
   * Apps typically pass something like `t('sidebar.memberStatus', {}, { defaultValue: 'Premium Member' })`.
   * When omitted and the auth user has an email, the email is shown instead.
   */
  secondaryLine?: string
  /** Optional avatar image URL — overrides `useAuth().user?.avatarUrl`. */
  avatarUrl?: string
  /** i18n key for the trigger button's aria-label. Default: `'sidebarUserCard.open'`. */
  ariaLabelKey?: string
  /** Fallback aria-label if the i18n key is missing. Default: `'Open account menu'`. */
  ariaLabelDefault?: string
  /**
   * `data-mol-id` for the trigger button. Defaults to
   * `'sidebar-user-card'`. Pass a different value (e.g. `'user-menu'`)
   * to disambiguate or align with an app's existing e2e selectors.
   */
  dataMolId?: string
}

ThemeToggleProps

Props for {@link ThemeToggle}.

Extends the framework-agnostic button element props so callers can pass any extra data-*, aria-*, event handler, or style prop without forking the component. The handful of explicitly named props below let apps swap the icon glyphs, label, or size without spreading attribute concerns.

interface ThemeToggleProps extends Omit<
  ButtonElementProps,
  'aria-label' | 'aria-pressed' | 'onClick' | 'type'
> {
  /** i18n key for the `aria-label`. Defaults to `'theme.toggle'`. */
  ariaLabelKey?: string
  /** Fallback `aria-label` if the i18n key is missing. Defaults to `'Toggle theme'`. */
  ariaLabelDefault?: string
  /** Icon name to render in dark mode. Defaults to `'moon'`. */
  darkIcon?: IconName
  /** Icon name to render in light mode. Defaults to `'sun'`. */
  lightIcon?: IconName
  /** Pixel size for the rendered icon. Defaults to `20`. */
  iconSize?: number
}

UserMenuProps

Props for {@link UserMenu}.

The inner trigger is a Molecule <Button> whose own prop set conflicts with raw ButtonHTMLAttributes (color, value, size enums), so this component exposes a curated set of customization points instead of extending HTML attributes. For one-off extra attributes, pass them via dataMolId / className / style props.

interface UserMenuProps {
  /**
   * Panel content shown inside the drawer/modal (typically the app's
   * `SettingsPanel`). It can dismiss the drawer by calling
   * `usePanelClose()` — no `onClose` prop-threading required.
   */
  children: ReactNode
  /**
   * i18n key for the trigger button's aria-label. Defaults to
   * `'userMenu.open'`. Apps whose existing locales use a different key
   * (e.g. `'userMenu.openButton'`) can override.
   */
  ariaLabelKey?: string
  /** Fallback aria-label if the i18n key is missing. Defaults to `"Open user menu"`. */
  ariaLabelDefault?: string
  /** Icon name for the trigger button. Defaults to `'user'`. */
  triggerIcon?: IconName
  /** Pixel size for the trigger icon. Defaults to 20. */
  triggerIconSize?: number
  /**
   * `data-mol-id` for the trigger button. Defaults to `'user-menu'`.
   * Pass an explicit value to disambiguate when the same page mounts
   * more than one UserMenu.
   */
  dataMolId?: string
  /** Extra className composed onto the trigger button. */
  className?: string
  /** Whether the trigger button is disabled. */
  disabled?: boolean
  /**
   * Override the trigger button's click handler. When provided, called
   * instead of opening the panel — hosts use this to intercept the click
   * (e.g. to open an auth modal for guest users).
   */
  onClick?: () => void
  /**
   * Which side of the viewport the panel opens from. Defaults to
   * `'right'`. Apps whose sidebar trigger sits on the left should pass
   * `'left'` so the panel opens adjacent to the trigger.
   */
  side?: 'left' | 'right'
}

UserMenuPopoverProps

Props for {@link UserMenuPopover}.

interface UserMenuPopoverProps {
  /**
   * The trigger and panel — typically `<UserMenuPopoverTrigger />` and
   * `<UserMenuPopoverPanel>`.
   */
  children: ReactNode
  /**
   * Label shown when there is no authenticated user. Defaults to the
   * `userMenuPopover.guest` translation (English fallback `"Account"`).
   */
  guestName?: string
  /** Extra className composed onto the relative-positioned container. */
  className?: string
}

UserMenuPopoverTriggerProps

Props for {@link UserMenuPopoverTrigger}.

interface UserMenuPopoverTriggerProps {
  /** i18n key for the trigger's aria-label. Default: `'userMenu.open'`. */
  ariaLabelKey?: string
  /** Fallback aria-label if the i18n key is missing. Default: `'Open user menu'`. */
  ariaLabelDefault?: string
  /** `data-mol-id` for the trigger button. Default: `'user-menu'`. */
  dataMolId?: string
  /** Extra className composed onto the trigger button. */
  className?: string
}

UserMenuPopoverPanelProps

Props for {@link UserMenuPopoverPanel}.

interface UserMenuPopoverPanelProps {
  /**
   * Panel body — typically a set of `<Link>` nav items and a
   * `<UserMenuPopoverSignOut />`. Rendered inside a `<nav>` below the
   * built-in identity header.
   */
  children: ReactNode
  /** Extra className composed onto the absolute-positioned panel. */
  className?: string
  /** i18n key for the panel's aria-label. Default: `'userMenu.panelLabel'`. */
  ariaLabelKey?: string
  /** Fallback aria-label if the i18n key is missing. Default: `'Account menu'`. */
  ariaLabelDefault?: string
  /** `data-mol-id` for the panel. Default: `'user-menu-panel'`. */
  dataMolId?: string
}

UserMenuPopoverSignOutProps

Props for {@link UserMenuPopoverSignOut}.

interface UserMenuPopoverSignOutProps {
  /** i18n key for the button label. Default: `'userMenu.signOut'`. */
  labelKey?: string
  /** Fallback label if the i18n key is missing. Default: `'Sign out'`. */
  labelDefault?: string
  /** `data-mol-id` for the button. Default: `'user-menu-sign-out'`. */
  dataMolId?: string
  /** Extra className composed onto the button. */
  className?: string
}

ToastProps

Toast's root box attributes and notification content.

interface ToastProps
  extends
    Omit<OverlayRootProps, 'title'>,
    Omit<CoreToastProps, keyof HTMLElementProps | 'children'> {
  /** The displayed notification heading. */
  title?: CoreToastProps['title']
  /** Message shown when no description was supplied. */
  children?: ReactNode
}

TooltipProps

Tooltip's root box attributes and the trigger that shows its content.

interface TooltipProps
  extends
    OverlayRootProps,
    Omit<CoreTooltipProps, keyof HTMLElementProps | 'children' | 'content'> {
  /** The tooltip's content. */
  content: ReactNode
  /** The trigger whose focus or hover reveals the tooltip. */
  children: ReactNode
}

Types

EventHandler

Framework-agnostic event handler. An unannotated handler's event is E. It is declared as a method (as React types its own handlers), so TypeScript compares its parameter both ways: a handler written for the event a kit passes, such as (event: Event) => void on the Vue, Solid, Svelte and Angular kits or (event: React.ChangeEvent<HTMLInputElement>) => void on React's, is accepted too.

type EventHandler<E extends KitEvent = KitEvent> = {
  handle(event: E): void
}['handle']
  • event — The event, as the kit hands it (see {@link KitEvent}).

MouseEventHandler

Framework-agnostic mouse event handler.

type MouseEventHandler = EventHandler<KitMouseEvent>

KeyboardEventHandler

Framework-agnostic keyboard event handler.

type KeyboardEventHandler = EventHandler<KitKeyboardEvent>

FocusEventHandler

Framework-agnostic focus event handler.

type FocusEventHandler = EventHandler<KitFocusEvent>

ChangeEventHandler

Framework-agnostic change event handler.

type ChangeEventHandler = EventHandler<KitEvent>

FormEventHandler

Framework-agnostic form event handler.

type FormEventHandler = EventHandler<KitEvent>

Size

Standard size scale used across all molecule UI components (buttons, inputs, badges, etc.).

type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl'

ColorVariant

Semantic color variants used across components for status indication.

type ColorVariant = 'primary' | 'secondary' | 'success' | 'warning' | 'error' | 'info'

ButtonVariant

Button visual variant styles.

type ButtonVariant = 'solid' | 'outline' | 'ghost' | 'link'

InputType

Allowed HTML input type attribute values for the Input component.

type InputType =
  | 'text'
  | 'email'
  | 'password'
  | 'number'
  | 'tel'
  | 'url'
  | 'search'
  | 'date'
  | 'time'
  | 'datetime-local'

ModalSize

Modal size variants including full-screen.

type ModalSize = 'sm' | 'md' | 'lg' | 'xl' | 'full'

TooltipPlacement

Position where a tooltip renders relative to its trigger element (top, bottom, left, right, and corner variants).

type TooltipPlacement =
  'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end'

ShellSidebarWidth

Semantic sidebar width — the same stack-agnostic presets @molecule/app-sidebar-layout-react uses, so both shells render the same fleet geometry: sm → 208px, md → 240px (default), lg → 256px. A raw number is an exact pixel width. Applied via inline style (a specific pixel width is the documented "value a swappable ClassMap cannot express as a token" case).

type ShellSidebarWidth = 'sm' | 'md' | 'lg' | number

Children

Content accepted by the React renderer.

type Children = ReactNode

BadgeProps

Badge with React children.

type BadgeProps = WithNodes<Core.BadgeProps, 'children'>

ButtonProps

Button content, icons and shared activation handlers.

type ButtonProps = WithNodes<Core.ButtonProps, 'children' | 'leftIcon' | 'rightIcon'>

CardProps

Card with React children.

type CardProps = WithNodes<Core.CardProps, 'children'>

CardSectionProps

Content for a card header, title, description, body or footer.

type CardSectionProps = WithNodes<Core.CardSectionProps, 'children'>

ContainerProps

Width-constrained container with React children.

type ContainerProps = WithNodes<Core.ContainerProps, 'children'>

EmptyStateProps

Empty state with a React illustration and action.

type EmptyStateProps = WithNodes<Core.EmptyStateProps, 'icon' | 'action'>

FlexProps

Flex layout with React children.

type FlexProps = WithNodes<Core.FlexProps, 'children'>

FormFieldProps

Labeled wrapper for a field and its validation message.

type FormFieldProps = WithNodes<Core.FormFieldProps, 'children'>

FormProps

Form with React children and shared submit handlers.

type FormProps = WithNodes<Core.FormProps, 'children'>

GridProps

Grid layout with React children.

type GridProps = WithNodes<Core.GridProps, 'children'>

InputProps

Text input with React adornments and typed field events.

type InputProps = WithNodes<Core.InputProps, 'leftElement' | 'rightElement'>

PageHeaderProps

Page header with a React action slot.

type PageHeaderProps = WithNodes<Core.PageHeaderProps, 'actions'>

PageShellProps

Page shell with sidebar, top bar and main content.

type PageShellProps = WithNodes<Core.PageShellProps, 'children' | 'sidebar' | 'topbar'>

Functions

AuthGuard(props)

Route-element guard for authenticated sections of the app's route tree.

  • While useAuth().status is 'loading' (no session decision yet), renders the loadingFallback (or the default <div data-mol-id="auth-guard-loading">{t('common.loading')}</div>).
  • If the status is 'unauthenticated', renders nothing and redirects to loginPath (replacing the entry), carrying the attempted location in state.from for post-login restoration. On loginPath itself it renders its children instead, so a guard that wraps the whole route tree (login page included) does not redirect in a loop.
  • Otherwise renders children (or <RoutedView /> if none).

The guard reads status, not initialized: a stored token AND user make the FIRST render 'authenticated', so a protected page paints immediately instead of waiting for the background verification (validateSession()) or a current-user round trip. 'unavailable' (a retained candidate the server could not confirm) still renders the page and lets the API decide. It is not a confirmed-session boolean: isAuthenticated can be false and user can be null while a token/cookie-only candidate is unavailable, so never redirect on the boolean or require a profile in this state.

The default loading tag carries data-mol-id="auth-guard-loading" so AI agents and e2e tests can target it reliably. When the caller passes a custom loadingFallback, it's the caller's responsibility to include any data-mol-id they need.

function AuthGuard({
  loadingFallback,
  loadingKey = 'common.loading',
  loadingDefault = 'Loading...',
  loginPath = '/login',
  onAuthenticated,
  children,
}?: AuthGuardProps): ReactNode
  • props — {@link AuthGuardProps}

ConfirmDialog(props)

Are-you-sure-style confirmation modal for destructive actions.

Use standalone (around delete buttons, revoke tokens, irreversible migrations) or with a DangerZoneSection action.

function ConfirmDialog({
  open,
  onClose,
  title: titleProp,
  description: descriptionProp,
  confirmLabel,
  cancelLabel,
  onConfirm,
  destructive = true,
  children,
  loading,
}: ConfirmDialogProps): JSX.Element
  • props — Component props (see {@link ConfirmDialogProps}).

Icon(props)

Renders an SVG glyph looked up by name from the bonded @molecule/app-icons set, on React DOM and React Native.

Handles two icon-data shapes returned by the bond:

  1. Pre-rendered SVG markup (icon.svg), drawn by {@link SvgMarkup}. The bond is the trust boundary; only bond a set that controls its own SVG strings.
  2. Structured paths (icon.paths) — rendered as discrete <path> children, with optional stroke styling forwarded from the icon set.

An icon without an accessible name (aria-label, aria-labelledby or a role) is decorative: it is hidden from assistive technology and never takes focus.

function Icon({ name, size = 20, className, style, ...rest }: IconProps): React.JSX.Element
  • props — See {@link IconProps}.

Returns: The icon.

LanguagePicker(props)

Globe-icon button that opens a modal grid of every locale registered with the bonded i18n provider. Clicking a locale calls setLocale and closes the modal.

Reads locale, setLocale, and locales from {@link useTranslation}, so the list of choices stays in sync with whatever set the setupI18nDefault (or any other i18n setup) registered. No hardcoded language list — adding a locale to the i18n bond adds it to the picker.

Molecule-convention defaults baked in:

  • data-mol-id="language-picker-trigger" on the trigger button
  • data-mol-id="language-picker-modal" on the modal dialog
  • data-mol-id="language-picker-option-<code>" on each locale button
  • data-active on the currently-selected locale button
  • aria-label from the footer.language i18n key (default "Language")
function LanguagePicker({
  labelKey = 'footer.language',
  labelDefault = 'Language',
  modalTitleKey = 'languagePicker.modalTitle',
  modalTitleDefault = 'Choose language',
  icon = 'globe',
  iconSize = 16,
  display = 'name',
  className,
  style,
  testId,
  renderTrigger,
  ...rest
}?: LanguagePickerProps): JSX.Element
  • props — {@link LanguagePickerProps}

LoadErrorBanner(props)

Error banner with an owned pending-state Retry button.

function LoadErrorBanner({
  message,
  detail: detailProp,
  onRetry,
  retryLabel: retryLabelProp,
  retryMolId = 'load-error-retry',
  children,
  style,
  testId,
  ...rest
}: LoadErrorBannerProps): JSX.Element
  • props — Component props (see {@link LoadErrorBannerProps}).

PanelCloseProvider(props)

Provides the panel-close callback to descendants. Rendered internally by UserMenu and SidebarUserCard around their children; apps do not normally render this directly.

function PanelCloseProvider({ close, children }: PanelCloseProviderProps): JSX.Element
  • props — The close callback and the panel content.

Returns: The children wrapped in the close-context provider.

usePanelClose()

Returns the callback that dismisses the drawer the current panel is mounted in. Safe to call anywhere — returns a no-op when no enclosing UserMenu / SidebarUserCard provides one (e.g. a SettingsPanel rendered as a standalone page).

function usePanelClose(): () => void

Returns: A function that closes the enclosing drawer, or a no-op.

PromptDialog(props)

Modal that asks the user for a short string, replacing window.prompt.

function PromptDialog({
  open,
  onClose,
  title: titleProp,
  description: descriptionProp,
  placeholder,
  initialValue = '',
  onSubmit,
  confirmLabel,
  cancelLabel,
  destructive = false,
  inputMolId,
  confirmMolId,
  cancelMolId,
  children,
}: PromptDialogProps): JSX.Element
  • props — Component props (see {@link PromptDialogProps}).

useIsDesktop(query)

Whether the viewport is at least 768px wide (the fleet's md breakpoint).

Reads window.matchMedia synchronously in the state initializer, so the FIRST client render is already correct — no mobile-then-desktop swap frame (this is time-tracking's QA-hardened version; the naive "state starts false, sync in an effect" variant mounts the wrong shell for one frame and double-fetches route data on desktop). Subscribes to change events afterwards. Guarded for non-browser environments (SSR/node): returns false (the mobile shell) when no window.matchMedia exists.

function useIsDesktop(query?: string): boolean
  • query — Override the media query. Defaults to (min-width: 768px).

Returns: Whether the desktop shell should mount.

ResponsiveAppShellTopBar(props)

The shell's <header> landmark: menu trigger (mobile, when a Drawer is composed), brand, and trailing actions.

Sticks to the top of the viewport by default. The menu trigger renders only while a ResponsiveAppShell.Drawer is part of the composition AND the viewport is below the breakpoint.

function ResponsiveAppShellTopBar({
  brand,
  actions,
  mobileOnly = false,
  className,
  dataMolId = 'shell-topbar',
  testId,
}: ResponsiveAppShellTopBarProps): JSX.Element | null
  • props — Brand/actions slots, mobileOnly, and class/id overrides.

Returns: The header landmark, or null when mobileOnly is set on desktop.

ResponsiveAppShellSidebar(props)

The desktop sidebar (<aside> + <nav> landmarks). Renders NOTHING below 768px — the {@link ResponsiveAppShellDrawer} carries the nav there.

Full viewport height, sticky at the top edge, scrolls internally when its content outgrows the viewport.

function ResponsiveAppShellSidebar({
  children,
  navLabel,
  footer,
  className,
  dataMolId = 'shell-sidebar',
  testId,
}: ResponsiveAppShellSidebarProps): JSX.Element | null
  • props — Nav children, nav label, footer slot, class/id overrides.

Returns: The sidebar landmarks, or null below the breakpoint.

ResponsiveAppShellDrawer(props)

The mobile nav drawer (<768px): a left-anchored dialog panel over a backdrop, opened by the menu trigger the TopBar renders.

Implements the WAI-ARIA APG dialog pattern — focus moves into the panel on open and returns to the previously focused element (the trigger) on close, Tab is trapped inside, Escape and backdrop clicks close, body scroll locks (reference-counted with any stacked <Modal>), and the shell closes it on SPA navigation. Renders nothing on desktop or while closed.

function ResponsiveAppShellDrawer({
  children,
  header,
  navLabel,
  footer,
  showCloseButton = true,
  className,
  dataMolId = 'shell-drawer',
  closeDataMolId = 'shell-drawer-close',
  testId,
}: ResponsiveAppShellDrawerProps): JSX.Element | null
  • props — Nav children, header/nav-label/footer slots, close-button and class/id overrides.

Returns: The drawer portal while open on mobile, otherwise null.

ResponsiveAppShellContent(props)

The shell's <main> landmark. Grows to fill the row and may shrink below its content width, so page-level overflow-x strips scroll inside the page instead of widening the whole shell.

function ResponsiveAppShellContent({
  children,
  className,
  style,
  dataMolId = 'shell-content',
  testId,
}: ResponsiveAppShellContentProps): JSX.Element
  • props — The page content and class/id overrides.

Returns: The main landmark.

SidebarUserCard(props)

Sidebar-resident user-account card: avatar + name + status line, opens the app's settings drawer on click.

Drop-in replacement for <UserMenu /> when the trigger lives inside a vertical sidebar (e.g. as the userMenu slot of <SidebarLayout>). Reads name/email/avatar from useAuth() by default; pass explicit name / secondaryLine / avatarUrl props to override.

Ships with data-mol-id="sidebar-user-card" on the trigger button by default for AI-agent / e2e selection. Callers can override by passing data-mol-id as an extra prop.

function SidebarUserCard({
  children,
  name,
  secondaryLine,
  avatarUrl,
  ariaLabelKey = 'sidebarUserCard.open',
  ariaLabelDefault = 'Open account menu',
  dataMolId = 'sidebar-user-card',
  className,
  style,
  testId,
  ...rest
}: SidebarUserCardProps): JSX.Element

ThemeToggle(props)

Button that flips the wired theme bond between light and dark.

Reads mode and toggleTheme from useTheme() and shows the configured dark/light icon accordingly. Ships with molecule conventions out of the box:

  • data-mol-id="theme-toggle" for AI-agent / e2e selection
  • data-mode={mode} so tests can assert current state via DOM
  • aria-pressed={mode === 'dark'} for screen-reader state
  • aria-label from the theme.toggle i18n key (default "Toggle theme")

Every per-app variant the fleet was carrying — extra data-* attrs, additional aria-* flags, custom event handlers — is now absorbed via the spread of unknown props. Apps that need different icons or label text use the named props.

function ThemeToggle({
  ariaLabelKey = 'theme.toggle',
  ariaLabelDefault = 'Toggle theme',
  darkIcon = 'moon',
  lightIcon = 'sun',
  iconSize = 20,
  className,
  style,
  testId,
  ...rest
}?: ThemeToggleProps): JSX.Element
  • props — {@link ThemeToggleProps}

ToastProvider(props)

Provider component that manages global toast state.

function ToastProvider({ children, position = 'bottom-right' }: ToastProviderProps): JSX.Element
  • props — The component props.
  • props.children — The child elements to render within the provider.
  • props.position — The default position for toasts.

Returns: The rendered provider with toast container.

UserMenu(props)

Avatar-style trigger that opens the app's settings panel in a drawer.

The panel content is passed as children so apps can mount their own SettingsPanel (which diverges per app) inside the shared drawer chrome. Panel content dismisses the drawer via usePanelClose().

Ships with data-mol-id="user-menu" on the trigger button by default for AI-agent / e2e selection.

function UserMenu({
  children,
  ariaLabelKey = 'userMenu.open',
  ariaLabelDefault = 'Open user menu',
  triggerIcon = 'user',
  triggerIconSize = 20,
  dataMolId = 'user-menu',
  className,
  disabled,
  onClick,
  side = 'right',
}: UserMenuProps): JSX.Element

UserMenuPopover(props)

Container for the inline popover account menu. Owns