@molecule/app-ui-solid

Framework · ui · App (browser) · v1.12.4 · Apache-2.0

Solid UI components for molecule.dev

npm install @molecule/app-ui-solid

npm · Source on GitHub · Implements @molecule/app-ui

How it works

@molecule/app-ui-solid adapts the @molecule/* cores to the ui framework on the app (browser) side.

import { setClassMap } from '@molecule/app-ui'
import { classMap } from '@molecule/app-ui-tailwind'
import { Button, Card, Modal } from '@molecule/app-ui-solid'
import { createSignal } from 'solid-js'

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

function ConfirmPanel() {
  const [open, setOpen] = createSignal(false)
  return (
    <Card>
      <Button color="primary" onClick={() => setOpen(true)}>
        Open
      </Button>
      <Modal open={open()} onClose={() => setOpen(false)} title="Confirm">
        <Button color="error" onClick={() => setOpen(false)}>
          Done
        </Button>
      </Modal>
    </Card>
  )
}

Works with: @molecule/app-filesystem, @molecule/app-i18n, @molecule/app-icons, @molecule/app-solid, @molecule/app-ui

Reference

SolidJS UI components for molecule.dev.

Implements the same component surface as @molecule/app-ui-react, styled through the UIClassMap abstraction: the core @molecule/app-ui components (Accordion, Alert, Avatar, Badge, Button, Card, Checkbox, Dropdown, Form, Input, Layout helpers, Modal, Pagination, Progress, RadioGroup, Select, Separator, Skeleton, Spinner, Switch, Table, Tabs, Textarea, Toast, Tooltip) plus the app-level components (AuthGuard, ConfirmButton, ConfirmDialog, EmptyState, FloatingInput, Icon, LanguagePicker, LoadErrorBanner, OptimisticToggleButton, PageHeader, PageShell, PanelClose, PromptDialog, ResponsiveAppShell, SidebarUserCard, ThemeToggle, UserMenu, UserMenuPopover) and their hooks (usePanelClose, useToast, useIsDesktop, useUserMenuPopoverClose). Props keep React's names and value shapes (className, camelCase style objects, onClick).

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, Card, Modal } from '@molecule/app-ui-solid'
import { createSignal } from 'solid-js'

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

function ConfirmPanel() {
  const [open, setOpen] = createSignal(false)
  return (
    <Card>
      <Button color="primary" onClick={() => setOpen(true)}>
        Open
      </Button>
      <Modal open={open()} onClose={() => setOpen(false)} title="Confirm">
        <Button color="error" onClick={() => setOpen(false)}>
          Done
        </Button>
      </Modal>
    </Card>
  )
}

Type

framework

Installation

npm install @molecule/app-ui-solid @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-solid @molecule/app-ui solid-js

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 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 `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. `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. `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
}

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
}

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
}

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
}

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'
}

SeparatorProps

Props for the Separator/Divider component.

interface SeparatorProps extends BaseProps {
  /**
   * Separator orientation.
   */
  orientation?: 'horizontal' | 'vertical'

  /**
   * Whether the separator is decorative only.
   */
  decorative?: boolean
}

AuthGuardProps

Props for 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 the auth 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?: JSX.Element
  /**
   * 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 the auth status is `'unauthenticated'`.
   * Defaults to `'/login'`. The current location 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: pass
   * the page then.
   */
  children?: JSX.Element
}

ConfirmButtonProps

Props for ConfirmButton.

interface ConfirmButtonProps extends Omit<
  ButtonProps,
  'onClick' | 'children' | 'loading' | 'loadingText' | 'type'
> {
  /**
   * 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: JSX.Element
  /**
   * Visible label in the armed state — the "click again to confirm" step.
   * Defaults to a localized "Confirm?" via the i18n bond.
   */
  confirmLabel?: JSX.Element
  /**
   * Visible label while `ConfirmButtonProps.onConfirm` is pending.
   * Defaults to a localized "Working…".
   */
  pendingLabel?: JSX.Element
  /**
   * Seconds before the armed state auto-disarms back to idle. `0` disables
   * auto-disarm.
   */
  disarmSeconds?: number
}

ConfirmDialogProps

Props for ConfirmDialog.

interface ConfirmDialogProps {
  /** Whether the dialog is open. */
  open: boolean
  /** Called when the dialog should close (escape, backdrop, cancel). */
  onClose: (event?: MouseEvent) => void
  /** Title. */
  title: JSX.Element
  /** Body / warning text. */
  description: JSX.Element
  /** Confirm-button label (e.g. "Delete"). */
  confirmLabel?: JSX.Element
  /** Cancel-button label. */
  cancelLabel?: JSX.Element
  /** 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?: JSX.Element
  /**
   * 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
}

FloatingInputProps

Props for FloatingInput: the input element attributes plus the React-only spellings this binding keeps (className, defaultValue).

interface FloatingInputProps extends Omit<JSX.InputHTMLAttributes<HTMLInputElement>, 'onChange'> {
  /**
   * Called on every keystroke, as React's text-input `onChange` is. A function only: the
   * component calls it itself, so Solid's bound `[handler, data]` form is not accepted.
   */
  onChange?: JSX.ChangeEventHandler<HTMLInputElement, Event>
  /** Receives the typed text on each input event. */
  onValueChange?: (value: string) => void
  /** Extra classes appended to the input (React spelling). */
  className?: string
  /** Initial value of the uncontrolled input (React spelling). */
  defaultValue?: string | number | readonly string[]
}

SolidFormProps

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

interface SolidFormProps extends FormProps {
  /** A rejected submission, for example a form controller's `submitError`. */
  submitError?: unknown
}

IconProps

Props for Icon.

Extends the SVG element attributes so callers can pass any SVG / HTML attribute the underlying <svg> accepts, including data-mol-id, aria-*, role, event handlers, style, etc. — without the component needing to enumerate them.

interface IconProps extends Omit<
  JSX.SvgSVGAttributes<SVGSVGElement>,
  'width' | 'height' | 'viewBox' | 'fill'
> {
  /**
   * Name of the glyph to look up in the bonded icon set. Typed as
   * `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
}

LanguagePickerProps

Props for LanguagePicker.

Extends standard <button> attributes 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<
  JSX.ButtonHTMLAttributes<HTMLButtonElement>,
  '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: the locale's native name
   * (`'name'`, the default), its lowercase code (`'code'`), or the icon alone
   * (`'icon'`).
   */
  display?: 'name' | 'code' | 'icon'
  /** Optional className appended to the trigger button. */
  className?: string
  /** `data-testid` for the trigger button. */
  testId?: string
  /** Optional render override: receives `{ open }` and replaces the default trigger. */
  renderTrigger?: (open: () => void) => JSX.Element
}

LoadErrorBannerProps

Props for LoadErrorBanner. Rest props are forwarded to the root <div>, so they are typed as its attributes.

interface LoadErrorBannerProps extends Omit<JSX.HTMLAttributes<HTMLDivElement>, 'children'> {
  /** The primary error line (e.g. the localized "Could not load X."). */
  message: JSX.Element
  /** Secondary line under the message (status code, hint). */
  detail?: JSX.Element
  /**
   * 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?: JSX.Element
  /** `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?: JSX.Element
  /** Extra classes on the root `<div>`. */
  className?: string
  /** Inline styles on the root `<div>`. */
  style?: JSX.CSSProperties
  /** `data-testid` for the root `<div>`. */
  testId?: string
}

OptimisticToggleButtonProps

Props for 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: JSX.Element
  /** Label when the displayed value is false. */
  inactiveLabel: JSX.Element
  /** Receives a failed save after the controller has restored the last confirmed value. */
  onError?: (error: unknown) => void
}

PanelCloseProviderProps

Props for PanelCloseProvider.

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

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 PromptDialog.

interface PromptDialogProps {
  /** Whether the dialog is open. */
  open: boolean
  /** Called when the dialog should close (escape, backdrop, cancel, or a fulfilled `onSubmit`). */
  onClose: (event?: MouseEvent) => void
  /** Dialog heading. */
  title: JSX.Element
  /** Explanatory line under the title. */
  description?: JSX.Element
  /** 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 `children`).
   */
  onSubmit: (value: string) => void | Promise<void>
  /** Confirm-button label. Falls back to a localized "Confirm". */
  confirmLabel?: JSX.Element
  /** Cancel-button label. Falls back to a localized "Cancel". */
  cancelLabel?: JSX.Element
  /** 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?: JSX.Element
}

ResponsiveAppShellProps

Props for the ResponsiveAppShell root.

interface ResponsiveAppShellProps {
  /**
   * The shell sub-components — `ResponsiveAppShellTopBar`,
   * `ResponsiveAppShellSidebar`, `ResponsiveAppShellDrawer` and
   * `ResponsiveAppShellContent`.
   */
  children: JSX.Element
  /**
   * 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 ResponsiveAppShellTopBar sub-component.

interface ResponsiveAppShellTopBarProps {
  /** Brand/title node, rendered after the menu trigger. */
  brand?: JSX.Element
  /** Trailing actions — user menu, theme toggle, search, etc. */
  actions?: JSX.Element
  /** Render the top bar only below the breakpoint. Default: `false`. */
  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 ResponsiveAppShellSidebar sub-component.

interface ResponsiveAppShellSidebarProps {
  /** Nav content — the links (they land inside the sidebar's `<nav>` landmark). */
  children: JSX.Element
  /**
   * Accessible name for the sidebar's `<nav>` landmark. Defaults to the
   * `appShell.primaryNav` translation.
   */
  navLabel?: string
  /** Below-nav content (user card, quick action). */
  footer?: JSX.Element
  /** 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 ResponsiveAppShellDrawer sub-component.

interface ResponsiveAppShellDrawerProps {
  /** Nav content. */
  children: JSX.Element
  /** Header row content (typically the brand), rendered next to the close button. */
  header?: JSX.Element
  /** Accessible name for the dialog and its `<nav>` landmark. */
  navLabel?: string
  /** Below-nav content (user card, sign-out), after the `<nav>`. */
  footer?: JSX.Element
  /** 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 ResponsiveAppShellContent sub-component.

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

SolidSelectProps

Props for Select: the core contract plus the React-style defaultValue spelling the uncontrolled path mirrors.

interface SolidSelectProps<T = string> extends SelectProps<T> {
  /**
   * Initial selection for an uncontrolled select (React's `defaultValue`).
   * Used only while `value` is omitted.
   */
  defaultValue?: T
}

SidebarUserCardProps

Props for the SidebarUserCard component.

Extends standard <button> attributes so callers can pass extra data-*, aria-*, style, or event handler props onto the trigger button without forking.

interface SidebarUserCardProps extends Omit<
  JSX.ButtonHTMLAttributes<HTMLButtonElement>,
  'aria-label' | 'onClick' | 'children'
> {
  /**
   * 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: JSX.Element
  /**
   * Display name override. When omitted, falls back to
   * `getAuthClient().getState().user?.name`, then `email`, then a guest label.
   */
  name?: string
  /**
   * Secondary line under the name (role, plan, status, etc.). When omitted
   * and the auth user has an email, the email is shown instead.
   */
  secondaryLine?: string
  /** Optional avatar image URL — overrides the auth user's `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'`.
   */
  dataMolId?: string
  /** Extra classes on the trigger button. */
  className?: string
  /** `data-testid` for the trigger button. */
  testId?: string
}

ThemeToggleProps

Props for ThemeToggle.

Extends standard <button> attributes 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<
  JSX.ButtonHTMLAttributes<HTMLButtonElement>,
  '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
  /** Extra classes composed onto the button. */
  className?: string
  /** `data-testid` for the button. */
  testId?: string
}

UserMenuProps

Props for UserMenu.

The inner trigger is a Molecule <Button> whose own prop set conflicts with raw button attributes (color, value, size enums), so this component exposes a curated set of customization points instead of extending HTML attributes.

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: JSX.Element
  /** i18n key for the trigger button's aria-label. Defaults to `'userMenu.open'`. */
  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'`. */
  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?: (event: MouseEvent) => void
  /**
   * Which side of the viewport the panel opens from. Defaults to `'right'`.
   */
  side?: 'left' | 'right'
}

UserMenuPopoverProps

Props for UserMenuPopover.

interface UserMenuPopoverProps {
  /**
   * The trigger and panel — typically `<UserMenuPopoverTrigger />` and
   * `<UserMenuPopoverPanel>`.
   */
  children: JSX.Element
  /**
   * 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 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 UserMenuPopoverPanel.

interface UserMenuPopoverPanelProps {
  /**
   * Panel body — typically a set of `<a>` nav items and a
   * `<UserMenuPopoverSignOut />`. Rendered inside a `<nav>` below the
   * built-in identity header.
   */
  children: JSX.Element
  /** 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 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
}

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 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'

ReactFormProps

Props for the form under React's name, so code typed against @molecule/app-ui-react's Form compiles unchanged after swapping the binding: React's members (FormProps plus the opaque submitError) in Solid's form.

Equal to SolidFormProps by definition, so the React-named contract and the Solid one cannot drift.

type ReactFormProps = SolidFormProps

ShellSidebarWidth

Semantic sidebar width — sm → 208px, md → 240px (default), lg → 256px. A raw number is an exact pixel width.

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

Children

A node a Solid component renders: plain JSX (@molecule/app-ui's Children, for Solid).

type Children = JSX.Element

AccordionItem

An accordion item, with its header and content typed as Solid nodes.

type AccordionItem<T = string> = WithNodes<CoreAccordionItem<T>, 'header' | 'content'>

AccordionProps

Accordion props, with each item's nodes typed as Solid nodes.

type AccordionProps<T = string> = Omit<CoreAccordionProps<T>, 'items'> & {
  /** The accordion's items. */
  items: AccordionItem<T>[]
}

AlertProps

Alert props, with its children and icon typed as Solid nodes.

type AlertProps = Omit<WithNodes<CoreAlertProps, 'children' | 'icon'>, 'onDismiss'> & {
  onDismiss?: (event: MouseEvent) => void
}

AvatarProps

Avatar props, with its fallback typed as a Solid node.

type AvatarProps = WithNodes<CoreAvatarProps, 'fallback'>

BadgeProps

Badge props, with its children typed as Solid nodes.

type BadgeProps = WithNodes<CoreBadgeProps, 'children'>

ButtonProps

Button props, with its children and icons typed as Solid nodes.

type ButtonProps = Omit<
  WithNodes<CoreButtonProps, 'children' | 'leftIcon' | 'rightIcon'>,
  'onClick'
> & { onClick?: (event: MouseEvent) => void }

CardProps

Card props, with its children typed as Solid nodes.

type CardProps = WithNodes<CoreCardProps, 'children'>

CardSectionProps

Content for a card header, title, description, content or footer, with its children typed as Solid nodes.

type CardSectionProps = WithNodes<CoreCardSectionProps, 'children'>

CheckboxProps

Checkbox props, with its label typed as Solid node.

type CheckboxProps = WithNodes<CoreCheckboxProps, 'label'>

ContainerProps

Container props, with its children typed as Solid nodes.

type ContainerProps = WithNodes<CoreContainerProps, 'children'>

A dropdown item, with its label and icon typed as Solid nodes.

type DropdownItem<T = string> = WithNodes<CoreDropdownItem<T>, 'label' | 'icon'>

Dropdown props, with its trigger and each item's nodes typed as Solid nodes.

type DropdownProps<T = string> = Omit<WithNodes<CoreDropdownProps<T>, 'trigger'>, 'items'> & {
  /** The menu's items. */
  items: DropdownItem<T>[]
}

EmptyStateProps

Empty state props, with its icon and action typed as Solid nodes.

type EmptyStateProps = WithNodes<CoreEmptyStateProps, 'icon' | 'action'>

FlexProps

Flex props, with its children typed as Solid nodes.

type FlexProps = WithNodes<CoreFlexProps, 'children'>

FormFieldProps

Form field props, with its children typed as Solid nodes.

type FormFieldProps = WithNodes<CoreFormFieldProps, 'children'>

FormProps

Form props, with its children typed as Solid nodes.

type FormProps = WithNodes<CoreFormProps, 'children'>

GridProps

Grid props, with its children typed as Solid nodes.

type GridProps = WithNodes<CoreGridProps, 'children'>

InputProps

Input props, with its left and right elements typed as Solid nodes.

type InputProps = WithFieldChange<
  Omit<WithNodes<CoreInputProps, 'leftElement' | 'rightElement'>, 'onClear'> & {
    onClear?: (event: MouseEvent) => void
  },
  HTMLInputElement
>

TextareaProps

Textarea props with the native textarea change event.

type TextareaProps = WithFieldChange<CoreTextareaProps, HTMLTextAreaElement>

SelectProps

Select props with the native select change event.

type SelectProps<T = string> = WithFieldChange<CoreSelectProps<T>, HTMLSelectElement>

ModalProps

Modal props, with its children and footer typed as Solid nodes.

type ModalProps = Omit<WithNodes<CoreModalProps, 'children' | 'footer'>, 'onClose'> & {
  onClose: (event?: MouseEvent) => void
}

PageHeaderProps

Page header props, with its actions typed as Solid nodes.

type PageHeaderProps = WithNodes<CorePageHeaderProps, 'actions'>

PageShellProps

Page shell props, with its children, sidebar and topbar typed as Solid nodes.

type PageShellProps = Omit<
  WithNodes<CorePageShellProps, 'children' | 'sidebar' | 'topbar'>,
  'onSidebarToggle'
> & {
  onSidebarToggle?: (event: MouseEvent) => void
}

RadioOption

A radio option, with its label typed as a Solid node.

type RadioOption<T = string> = WithNodes<CoreRadioOption<T>, 'label'>

RadioGroupProps

Radio group props, with each option's label typed as a Solid node.

type RadioGroupProps<T = string> = Omit<CoreRadioGroupProps<T>, 'options'> & {
  /** The group's options. */
  options: RadioOption<T>[]
}

SwitchProps

Switch props, with its label typed as a Solid node.

type SwitchProps = WithNodes<CoreSwitchProps, 'label'>

TabItem

A tab, with its label, content and icon typed as Solid nodes.

type TabItem<T = string> = WithNodes<CoreTabItem<T>, 'label' | 'content' | 'icon'>

TabsProps

Tabs props, with each tab's nodes typed as Solid nodes.

type TabsProps<T = string> = Omit<CoreTabsProps<T>, 'items'> & {
  /** The tabs. */
  items: TabItem<T>[]
}

TableColumn

A table column, with its header and the cells its render returns typed as Solid nodes.

type TableColumn<T> = Omit<WithNodes<CoreTableColumn<T>, 'header'>, 'render'> & {
  /**
   * Renders a cell of this column.
   *
   * @param value - The row's value for the column's key.
   * @param row - The row.
   * @param index - The row's index.
   * @returns The cell's content.
   */
  render?: (value: unknown, row: T, index: number) => JSX.Element
}

TableProps

Table props, with its empty content and each column's nodes typed as Solid nodes.

type TableProps<T> = Omit<WithNodes<CoreTableProps<T>, 'emptyContent'>, 'columns'> & {
  /** The table's columns. */
  columns: TableColumn<T>[]
}

ToastProps

Toast props, with its children typed as Solid nodes.

type ToastProps = WithNodes<CoreToastProps, 'children'>

TooltipProps

Tooltip props, with its content and children typed as Solid nodes.

type TooltipProps = WithNodes<CoreTooltipProps, 'content' | 'children'>

Functions

AuthGuard(props)

Route guard for authenticated sections of the app tree.

  • While the auth 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 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(props: AuthGuardProps): JSX.Element
  • props — AuthGuardProps

ConfirmButton(props)

Two-step destructive-action button: the first click ARMS it ("Confirm?"), the second commits. Auto-disarms after ConfirmButtonProps.disarmSeconds (default 4s) so an armed-then-abandoned row can't surprise anyone later.

The whole button is the target, the armed state is announced through aria-live, and Escape disarms.

function ConfirmButton(props: WithRef<ConfirmButtonProps, HTMLButtonElement>): JSX.Element
  • props — Component props (see ConfirmButtonProps).

Returns: The rendered two-step button.

ConfirmDialog(props)

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

function ConfirmDialog(props: ConfirmDialogProps): JSX.Element
  • props — Component props (see ConfirmDialogProps).

Returns: The rendered confirmation dialog.

EmptyState(props)

Renders the EmptyState component.

Displays a centered placeholder with an optional icon, title, description, and a primary action when a list or section has no content.

function EmptyState(
  props: WithRef<WithNodes<EmptyStateProps, 'icon' | 'action'>, HTMLDivElement>,
): JSX.Element
  • props — The component props.

Returns: The rendered empty-state JSX.

FileField(props)

Renders a browse target and passes the chooser handle to the caller's ref.

function FileField(props: FileFieldProps<JSX.Element> & { ref?: Ref<FileFieldHandle> }): JSX.Element
  • props — The field props.

Returns: The rendered field.

FloatingInput(props)

Renders an input with a floating label.

Shows the placeholder text as a small uppercase label always visible at the top of the input. On focus the label turns primary-colored.

Works as both a controlled and an uncontrolled input: when value is omitted, the component tracks its own state seeded from defaultValue and still forwards every onChange event to the caller.

The floating text is a real <label for> (not a bare <span>), so it is the input's programmatic accessible name via label association — previously the accessible name came only from placeholder (stripped by some AT/browser combos once the field has a value), and clicking the floating text did nothing because it wasn't associated with anything. id falls back to a generated id when the caller doesn't pass one, mirroring Input/Select/Textarea's id-collision fix.

function FloatingInput(props: WithRef<FloatingInputProps, HTMLInputElement>): JSX.Element
  • props — The input attributes.

Returns: The rendered floating-input JSX.

Icon(props)

Renders an SVG glyph looked up by name from the bonded @molecule/app-icons set.

Handles two icon-data shapes returned by the bond:

  1. Pre-rendered SVG markup (icon.svg) — injected through the element's innerHTML property. 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.

Any extra HTML/SVG attribute (e.g. data-mol-id, aria-label, role="img", onClick) is forwarded to the root <svg> via spread.

Decorative by default: when the caller passes no aria-label / aria-labelledby / role, the SVG is rendered aria-hidden + focusable="false" so screen readers skip it (an unnamed inline SVG is announced as a stray "image" by some combos). Passing any of those props opts the icon into the accessibility tree.

function Icon(props: IconProps): JSX.Element
  • props — IconProps

Returns: An <svg> element rendering the named glyph.

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.

function LanguagePicker(props: LanguagePickerProps): JSX.Element
  • props — Component props (see LanguagePickerProps).

Returns: The trigger and its locale modal.

LoadErrorBanner(props)

Error banner with an owned pending-state Retry button.

function LoadErrorBanner(props: LoadErrorBannerProps): JSX.Element
  • props — Component props (see LoadErrorBannerProps).

Returns: The rendered error banner.

OptimisticToggleButton(props)

An optimistic server-backed toggle: the first tap changes its label and pressed state, including while a previous save is pending. Saves run in order, using the latest desired boolean. The newest failure rolls back; onError lets the app show its own error message.

function OptimisticToggleButton(
  props: WithRef<OptimisticToggleButtonProps, HTMLButtonElement>,
): JSX.Element
  • props — Component props (see OptimisticToggleButtonProps).

Returns: The rendered toggle button.

PageHeader(props)

Renders the PageHeader component.

A page title with optional breadcrumb trail, description, and action buttons for a consistent page heading area.

function PageHeader(
  props: WithRef<WithNodes<PageHeaderProps, 'actions'>, HTMLDivElement>,
): JSX.Element
  • props — The component props.

Returns: The rendered page header JSX.

PageShell(props)

Renders the PageShell component.

The top-level layout for authenticated pages with an optional collapsible sidebar, a top bar, and a scrollable main content area.

function PageShell(props: WithRef<PageShellProps, HTMLDivElement>): JSX.Element
  • props — The component props.

Returns: The rendered page shell JSX.

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(props: 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(props: PromptDialogProps): JSX.Element
  • props — Component props (see PromptDialogProps).

Returns: The rendered prompt dialog.

useIsDesktop(query)

Whether the viewport is at least 768px wide (the fleet's md breakpoint). Read it inside JSX so the surrounding expression re-runs when the viewport crosses the breakpoint.

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.

function ResponsiveAppShellTopBar(props: ResponsiveAppShellTopBarProps): JSX.Element
  • props — Component props (see ResponsiveAppShellTopBarProps).

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

ResponsiveAppShellSidebar(props)

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

function ResponsiveAppShellSidebar(props: ResponsiveAppShellSidebarProps): JSX.Element
  • props — Component props (see ResponsiveAppShellSidebarProps).

Returns: The sidebar landmarks, or nothing 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 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.

function ResponsiveAppShellDrawer(props: ResponsiveAppShellDrawerProps): JSX.Element
  • props — Component props (see ResponsiveAppShellDrawerProps).

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

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(props: ResponsiveAppShellContentProps): JSX.Element
  • props — Component props (see ResponsiveAppShellContentProps).

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.

function SidebarUserCard(props: SidebarUserCardProps): JSX.Element
  • props — Component props (see SidebarUserCardProps).

Returns: The trigger button and its settings drawer.

ThemeToggle(props)

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

Reads the active theme from the theme provider context 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(props: ThemeToggleProps): JSX.Element
  • props — ThemeToggleProps

useToast()

Hook to access the toast context for adding and removing toasts.

function useToast(): ToastContextValue

Returns: The toast context value with toast management methods.

ToastProvider(props)

Provider component that manages global toast state.

function ToastProvider(props: ToastProviderProps): JSX.Element
  • props — The children and the default toast position.

Returns: The rendered provider with toast container JSX.

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 inside the shared drawer chrome. Panel content dismisses the drawer via usePanelClose().

function UserMenu(props: UserMenuProps): JSX.Element
  • props — Component props (see UserMenuProps).

Returns: The trigger button and its settings drawer.

UserMenuPopover(props)

Container for the inline popover account menu. Owns the open state and the auto-dismiss behaviour (route change, popstate, outside click, Escape), and provides the resolved account identity to its sub-components.

function UserMenuPopover(props: UserMenuPopoverProps): JSX.Element
  • props — The popover children, optional guest label, and className.

Returns: The relative-positioned popover container.

UserMenuPopoverTrigger(props)

The trigger button: an initials avatar plus the account name and email, styled as a full-width sidebar card. Toggles the popover panel.

function UserMenuPopoverTrigger(props: UserMenuPopoverTriggerProps): JSX.Element
  • props — aria-label overrides, data-mol-id, and className.

Returns: The popover trigger button.

UserMenuPopoverPanel(props)

The popover panel: an absolutely-positioned card with a built-in identity header (name + email) and a <nav> wrapping the caller's nav items. Renders nothing while the popover is closed.

function UserMenuPopoverPanel(props: UserMenuPopoverPanelProps): JSX.Element
  • props — The nav children, className, and aria-label overrides.

Returns: The popover panel, or nothing when closed.

useUserMenuPopoverClose()

Returns a callback that closes the enclosing UserMenuPopover. Useful for nav-item onClick handlers that should dismiss the popover even when they don't change the route. Returns a no-op when called outside a UserMenuPopover.

function useUserMenuPopoverClose(): () => void

Returns: A function that closes the popover.

UserMenuPopoverSignOut(props)

The sign-out nav item — closes the popover and calls the auth client's logout(). Drop it in as the last child of <UserMenuPopoverPanel>.

function UserMenuPopoverSignOut(props: UserMenuPopoverSignOutProps): JSX.Element
  • props — Label overrides, data-mol-id, and className.

Returns: The sign-out button.

webDrag(host, drag)

Bind the web kits' shared drag gesture from a Solid ref callback. Use ref={(host) => webDrag(host, () => handlers())} on an HTML or SVG element. The accessor returns a drag or { drag, zoom }. Undefined disables the gesture.

function webDrag(host: HTMLElement | SVGElement, drag: Accessor<WebDragOptions | undefined>): void
  • host — The element that owns the gesture.
  • drag — Reads the current handlers.

webHover(host, handlers)

Binds shared mouse and pen hover from a Solid ref. Use ref={(host) => webHover(host, () => ({ onEnter, onLeave }))}. Return undefined from the accessor to disable hover.

function webHover(
  host: HTMLElement | SVGElement,
  handlers: Accessor<WebHoverHandlers | undefined>,
): void
  • host — The HTML or SVG element that receives hover.
  • handlers — Reads the current callbacks.

cn(inputs)

Merge class name strings, filtering out falsy values (undefined, null, false).

function cn(...inputs: (string | undefined | null | false)[]): string
  • inputs — Class name strings or falsy values to be filtered out.

Returns: A single space-separated class string.

webWheelZoom(host, onStep)

Binds the shared Ctrl-wheel zoom step from a Solid ref. Use ref={(host) => webWheelZoom(host, () => onStep())}. Return undefined from the accessor to leave the wheel to the browser.

function webWheelZoom(
  host: HTMLElement | SVGElement,
  onStep: Accessor<WebWheelZoomHandler | undefined>,
): void
  • host — The surface receiving wheel events.
  • onStep — Reads the current zoom callback.

reactStyleText(style, space)

Serializes a React-shaped style object as React DOM's style attribute value. The renderer escapes the value when it writes HTML.

function reactStyleText(style: unknown, space?: '' | ' '): string | undefined
  • style — The style object, or an absent value.
  • space — An optional space after separators for existing bindings that use spaced CSS.

Returns: The CSS declaration text, or undefined when there are no declarations.

Constants

Accordion

Renders the Accordion component.

const Accordion: NamedComponent<WithRef<AccordionProps<string>, HTMLDivElement>>
  • props — The component props.

Returns: The rendered accordion JSX.

Alert

Renders the Alert component.

role="alert" is assertive: it interrupts a screen reader immediately, which is correct ONLY for content that appears dynamically (a validation error after submit, a save failure). An Alert rendered statically with the rest of the page (an informational banner already in the initial render) has nothing to interrupt — announcing it assertively on mount is the same over-announcing trap the Toast role fix addresses. live (default true, matching the previous unconditional behavior so no existing dynamic-error usage silently goes quiet) makes this honest and caller-controlled: pass live={false} for a banner that is part of the page's normal content, and it announces politely (role="status") instead of interrupting.

const Alert: NamedComponent<
  WithRef<
    Omit<WithNodes<AlertProps, 'children' | 'icon'>, 'onDismiss'> & {
      onDismiss?: (event: MouseEvent) => void
    } & { live?: boolean },
    HTMLDivElement
  >
>
  • props — The component props.

Returns: The rendered alert JSX.

Avatar

Renders the Avatar component.

const Avatar: NamedComponent<WithRef<WithNodes<AvatarProps, 'fallback'>, HTMLDivElement>>
  • props — The component props.

Returns: The rendered avatar JSX.

Badge

Renders the Badge component.

const Badge: NamedComponent<WithRef<WithNodes<BadgeProps, 'children'>, HTMLSpanElement>>
  • props — The component props.

Returns: The rendered badge JSX.

Button

Renders the Button component.

While loading is true, the native button is disabled and marked busy. Drive it from the request's pending state so an unavailable interaction is visible and the next click is accepted after the request settles. Loading does not queue clicks; an app that must preserve every intent needs its own serial action queue.

const Button: NamedComponent<WithRef<ButtonProps, HTMLButtonElement>>
  • props — The component props.

Returns: The rendered button JSX.

Card

Renders the Card component.

const Card: NamedComponent<
  WithRef<WithNodes<CardProps, 'children'> & { 'data-mol-id'?: string }, HTMLDivElement>
>
  • props — The component props.

Returns: The rendered card JSX.

CardHeader

Renders the CardHeader component.

const CardHeader: NamedComponent<
  WithRef<
    { children?: JSX.Element; className?: string } & JSX.HTMLAttributes<HTMLDivElement>,
    HTMLDivElement
  >
>
  • props — The div attributes to spread onto the header.

Returns: The rendered card header JSX.

CardTitle

Renders the CardTitle component.

const CardTitle: NamedComponent<
  WithRef<
    { children?: JSX.Element; className?: string } & JSX.HTMLAttributes<HTMLHeadingElement>,
    HTMLHeadingElement
  >
>
  • props — The heading attributes to spread onto the title.

Returns: The rendered card title JSX.

CardDescription

Renders the CardDescription component.

const CardDescription: NamedComponent<
  WithRef<
    { children?: JSX.Element; className?: string } & JSX.HTMLAttributes<HTMLParagraphElement>,
    HTMLParagraphElement
  >
>
  • props — The paragraph attributes to spread onto the description.

Returns: The rendered card description JSX.

CardContent

Renders the CardContent component.

const CardContent: NamedComponent<
  WithRef<
    { children?: JSX.Element; className?: string } & JSX.HTMLAttributes<HTMLDivElement>,
    HTMLDivElement
  >
>
  • props — The div attributes to spread onto the content.

Returns: The rendered card content JSX.

CardFooter

Renders the CardFooter component.

const CardFooter: NamedComponent<
  WithRef<
    { children?: JSX.Element; className?: string } & JSX.HTMLAttributes<HTMLDivElement>,
    HTMLDivElement
  >
>
  • props — The div attributes to spread onto the footer.

Returns: The rendered card footer JSX.

Checkbox

Renders the Checkbox component.

const Checkbox: NamedComponent<WithRef<WithNodes<CheckboxProps, 'label'>, HTMLInputElement>>
  • props — The component props.

Returns: The rendered checkbox JSX.

Dropdown component.

Implements the WAI-ARIA APG menu-button pattern. The trigger is made a real, keyboard-operable control: if trigger is a single element (a <button>, an icon <Button>, …) the menu-button attributes (aria-haspopup, aria-expanded, aria-controls) and the open/keyboard handlers are merged onto it directly — no extra wrapper, no double focus stop. If trigger is not a single element (text, an array, multiple nodes), it is wrapped in a role="button" tabIndex={0} container instead so keyboard/AT users can still reach it. Enter/Space/ArrowDown open the menu and move focus to the first item (ArrowUp opens to the last item); once open, ArrowUp/Down/Home/End roving-navigate the role="menuitem" items, Escape closes and returns focus to the trigger, and Tab closes the menu in sync with focus leaving it (matching native menus, which do not trap Tab).

const Dropdown: NamedComponent<WithRef<DropdownProps<string>, HTMLDivElement>>
  • props — The component props.

Returns: The rendered component element.

Dropdown label for grouping items.

const DropdownLabel: NamedComponent<
  WithRef<
    Pick<ElementProps, 'lang'> & { children?: JSX.Element; className?: string },
    HTMLDivElement
  >
>
  • props — The component props.

Returns: The rendered label element.

Dropdown separator for dividing groups.

const DropdownSeparator: NamedComponent<WithRef<{ className?: string }, HTMLDivElement>>
  • props — The component props.

Returns: The rendered separator element.

Form

Renders the Form component.

Rejected async handlers render an accessible server-error list by default. A new submit clears the previous failure; native action/method forms retain native submission.

const Form: NamedComponent<WithRef<SolidFormProps, HTMLFormElement>>
  • props — The component props.

Returns: The rendered form JSX.

FormField

Renders the FormField wrapper component.

The error/hint <p> below is a same-DOM sibling — invisible to a screen reader unless something actually points aria-describedby at it. When children is a single element (the common case: one Input/Select/ Textarea/Checkbox), id/aria-describedby/aria-invalid are injected onto its form control directly so its own label association and the announced description both resolve correctly. Composite/text children can't be safely injected into, so they fall back to label-only association — consumers with custom composite fields should wire their own aria-describedby (Input/Select/Textarea's own error prop remains the fully-automatic path).

const FormField: NamedComponent<WithRef<WithNodes<FormFieldProps, 'children'>, HTMLDivElement>>
  • props — The component props.

Returns: The rendered form field JSX.

Label

Renders the Label component.

const Label: NamedComponent<
  WithRef<
    {
      children?: JSX.Element
      required?: boolean
      className?: string
    } & JSX.HTMLAttributes<HTMLLabelElement>,
    HTMLLabelElement
  >
>
  • props — The label attributes (required adds the marker).

Returns: The rendered label JSX.

Input

Renders the Input component.

const Input: NamedComponent<WithRef<InputProps, HTMLInputElement>>
  • props — The component props.

Returns: The rendered input JSX.

Container

Renders the Container component.

const Container: NamedComponent<WithRef<WithNodes<ContainerProps, 'children'>, HTMLDivElement>>
  • props — The component props.

Returns: The rendered component element.

Flex

Renders the Flex container component.

const Flex: NamedComponent<WithRef<WithNodes<FlexProps, 'children'>, HTMLDivElement>>
  • props — The component props.

Returns: The rendered component element.

Grid

Renders the Grid container component.

const Grid: NamedComponent<WithRef<WithNodes<GridProps, 'children'>, HTMLDivElement>>
  • props — The component props.

Returns: The rendered component element.

Spacer

Renders the Spacer component.

const Spacer: NamedComponent<WithRef<SpacerProps, HTMLDivElement>>
  • props — The component props.

Returns: The rendered component element.

Renders the Modal component.

Renders into a document.body portal. Every other declared prop (id, title, aria-*, data-*, automationId as data-mol-id, the DOM event handlers) reaches the inner dialog <div>; a caller's role, tabIndex or aria-labelledby replaces the default (e.g. role="alertdialog").

The internal close button always carries data-mol-id="modal-close" as the molecule-convention default for the one fixed interactive element inside the chrome.

Implements the WAI-ARIA APG dialog (modal) pattern: on open, focus moves to the first focusable element inside the dialog (or the dialog itself when it has none); Tab/Shift+Tab are trapped inside the dialog; on close, focus returns to whatever was focused before the dialog opened. Stacked dialogs (a confirm above a drawer) each register on the document stack — Escape and the Tab trap only act for the TOPMOST dialog, and the body scroll lock is reference-counted so closing one of several open dialogs never unlocks scroll behind the ones still open.

const Modal: NamedComponent<
  WithRef<
    Omit<WithNodes<ModalProps, 'children' | 'footer'>, 'onClose'> & {
      onClose: (event?: MouseEvent) => void
    } & { 'data-mol-id'?: string },
    HTMLDivElement
  >
>
  • props — The component props.

Returns: The rendered modal JSX.

Pagination

Renders the Pagination component.

const Pagination: NamedComponent<WithRef<PaginationProps, HTMLElement>>
  • props — The component props.

Returns: The rendered pagination JSX.

Progress

Renders the Progress component.

const Progress: NamedComponent<WithRef<ProgressProps, HTMLDivElement>>
  • props — The component props.

Returns: The rendered progress JSX.

RadioGroup

Renders the RadioGroup component.

Radios only form a native group (arrow-key navigation, exclusive native checked state) when they share a name — and that name must be UNIQUE per group. The old label-as-name fallback merged every group sharing a visible label (e.g. two "Size" pickers) into ONE native group: selecting in one silently deselected the other. Callers that need a specific submitted field name pass the name prop.

const RadioGroup: NamedComponent<WithRef<RadioGroupProps<string>, HTMLDivElement>>
  • props — The component props.

Returns: The rendered radio group JSX.

ResponsiveAppShell

The responsive app shell family — the root component plus its four sub-components.

Consumed as <ResponsiveAppShell.TopBar />, .Sidebar, .Drawer and .Content inside <ResponsiveAppShell>; each is also exported as a named component.

const ResponsiveAppShell: Component<ResponsiveAppShellProps> & {
  TopBar: Component<ResponsiveAppShellTopBarProps>
  Sidebar: Component<ResponsiveAppShellSidebarProps>
  Drawer: Component<ResponsiveAppShellDrawerProps>
  Content: Component<ResponsiveAppShellContentProps>
}

Select

Renders the Select component.

const Select: NamedComponent<WithRef<SolidSelectProps<string>, HTMLSelectElement>>
  • props — The component props.

Returns: The rendered select JSX.

Separator

Renders the Separator component.

const Separator: NamedComponent<WithRef<SeparatorProps, HTMLDivElement>>
  • props — The component props.

Returns: The rendered separator JSX.

Skeleton

Renders the Skeleton component.

const Skeleton: NamedComponent<WithRef<SkeletonProps, HTMLDivElement>>
  • props — The component props.

Returns: The rendered skeleton JSX.

SkeletonText

Renders the SkeletonText component (placeholder text lines).

const SkeletonText: NamedComponent<WithRef<{ lines?: number; className?: string }, HTMLDivElement>>
  • props — The component props (lines defaults to 3).

Returns: The rendered skeleton text JSX.

SkeletonCircle

Renders the SkeletonCircle component (avatar placeholder).

const SkeletonCircle: NamedComponent<WithRef<{ size?: number; className?: string }, HTMLDivElement>>
  • props — The component props (size defaults to 40).

Returns: The rendered skeleton circle JSX.

Spinner

Renders the Spinner component.

Extracts data-* and aria-* props from the rest spread so callers can pass data-mol-id, custom aria-* overrides, etc. without forking.

const Spinner: NamedComponent<WithRef<SpinnerProps & { 'data-mol-id'?: string }, HTMLDivElement>>
  • props — The component props.

Returns: The rendered spinner JSX.

Switch

Renders the Switch component.

A hidden, real native checkbox mirrors checked — the click handler below calls .click() on it instead of forging a fake event object. Its change is a GENUINE browser Event, so event.preventDefault() / event.stopPropagation() are real methods (no more "not a function" crash) and event.target/currentTarget resolve to a real element with a real .checked. Kept as a SIBLING of the visible <label> (not a descendant of it) — both the checkbox and the <button> are "labelable" elements per the HTML spec, so nesting both inside one <label> risks the browser's native label-click-forwarding firing a SECOND, redundant click on whichever one isn't the direct target.

const Switch: NamedComponent<WithRef<WithNodes<SwitchProps, 'label'>, HTMLButtonElement>>
  • props — The component props.

Returns: The rendered switch JSX.

Table

Table component.

const Table: NamedComponent<WithRef<TableProps<Record<string, unknown>>, HTMLTableElement>>
  • props — The component props.

Returns: The rendered component element.

Tabs

Renders the Tabs component.

Implements the WAI-ARIA APG "automatic activation" tabs pattern: roving tabindex (only the active tab is a Tab stop) with Left/Right/Home/End moving BOTH focus and the active tab, so keyboard users never have to Tab through every trigger to reach the one they want. Disabled tabs are skipped.

const Tabs: NamedComponent<WithRef<TabsProps<string>, HTMLDivElement>>
  • props — The component props.

Returns: The rendered tabs JSX.

Textarea

Renders the Textarea component.

const Textarea: NamedComponent<WithRef<TextareaProps, HTMLTextAreaElement>>
  • props — The component props.

Returns: The rendered textarea JSX.

Toast

Renders a single Toast component.

The auto-dismiss countdown pauses on hover AND focus (WCAG 2.2.1) and resumes with whatever time was left — a slow reader or a keyboard/AT user interacting with the toast never has it disappear mid-read. The announced role follows status: warning/error get the assertive role="alert"; every other status (info, success, the default) gets the polite role="status" so routine confirmations don't interrupt a screen reader mid-sentence the way an assertive announcement does.

const Toast: NamedComponent<WithRef<WithNodes<ToastProps, 'children'>, HTMLDivElement>>
  • props — The component props.

Returns: The rendered toast JSX.

ToastContainer

Container that positions toasts on screen via a portal.

const ToastContainer: NamedComponent<WithRef<ToastContainerProps, HTMLDivElement>>
  • props — The component props.

Returns: The rendered toast container JSX.

Tooltip

Tooltip component.

hasArrow renders a small themed pointer at the resolved placement edge.

const Tooltip: NamedComponent<
  WithRef<WithNodes<TooltipProps, 'children' | 'content'>, HTMLDivElement>
>
  • props — The component props.

Returns: The rendered component element.

toStyleProps

Normalizes a React-shaped style object for a Solid JSX style binding.

const toStyleProps: typeof normalizeStyle
  • style — The style object.

Returns: CSS property names and values, or undefined for an absent style.

Injection Notes

Requirements

Peer dependencies:

  • @molecule/app-filesystem ^1.1.0
  • @molecule/app-i18n ^1.0.1
  • @molecule/app-icons ^1.0.1
  • @molecule/app-solid ^3.15.0 || ^4.0.0
  • @molecule/app-ui ^1.18.0
  • solid-js ^1.8.0

Runtime Dependencies

  • @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-solid

  • @molecule/app-ui

  • solid-js

  • setClassMap() must run before any component renders — every component resolves styling via getClassMap() from @molecule/app-ui, which THROWS until a ClassMap bond (e.g. @molecule/app-ui-tailwind) is set.

  • Follow Solid rules: pass signals as accessors in JSX (open={open()}), and don't destructure component props.

In an element ref, call webDrag, webHover, or webWheelZoom with the host and an accessor for the current handlers. Hover takes { onEnter, onLeave }, and Ctrl-wheel zoom takes an onStep callback. Return undefined from the accessor to disable a gesture.

Translations

Translation strings are provided by @molecule/app-locales-ui.