@molecule/app-ui-react
Framework · ui · App (browser) · v4.15.2 · Apache-2.0
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.
npm install @molecule/app-ui-reactnpm · Source on GitHub · Implements @molecule/app-ui
How it works
@molecule/app-ui-react 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, 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>
</>
)
}Works with: @molecule/app-filesystem, @molecule/app-i18n, @molecule/app-icons, @molecule/app-react, @molecule/app-ui
Reference
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.tsJSDoc, 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 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
}
TextareaProps
Props for the Textarea component.
Ref element: the native <textarea>.
interface TextareaProps extends TextareaElementProps, Pick<TextFieldProps, 'onValueChange'> {
/**
* Text size tier (see `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 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 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 `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 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 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
* `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 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 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 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 PanelCloseProvider.
interface PanelCloseProviderProps {
/** Callback that dismisses the enclosing drawer/modal. */
close: () => void
/** Panel content that may call `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 PromptDialog.
interface PromptDialogProps {
/** Whether the dialog is open. */
open: boolean
/** Called when the dialog should close (escape, backdrop, cancel, or a fulfilled `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 `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 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 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 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 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 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 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 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 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 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 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 `<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 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 (seeKitEvent).
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().statusis'loading'(no session decision yet), renders theloadingFallback(or the default<div data-mol-id="auth-guard-loading">{t('common.loading')}</div>). - If the status is
'unauthenticated', renders nothing and redirects tologinPath(replacing the entry), carrying the attempted location instate.fromfor post-login restoration. OnloginPathitself 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—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 (seeConfirmDialogProps).
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:
- Pre-rendered SVG markup (
icon.svg), drawn bySvgMarkup. The bond is the trust boundary; only bond a set that controls its own SVG strings. - 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— SeeIconProps.
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 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 buttondata-mol-id="language-picker-modal"on the modal dialogdata-mol-id="language-picker-option-<code>"on each locale buttondata-activeon the currently-selected locale buttonaria-labelfrom thefooter.languagei18n 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—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 (seeLoadErrorBannerProps).
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 (seePromptDialogProps).
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 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 selectiondata-mode={mode}so tests can assert current state via DOMaria-pressed={mode === 'dark'}for screen-reader statearia-labelfrom thetheme.togglei18n 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—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 the open state and
the auto-dismiss behaviour (route change, popstate, outside click,
Escape), and provides the resolved account identity to its
sub-components via context.
function UserMenuPopover({
children,
guestName,
className,
}: UserMenuPopoverProps): React.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({
ariaLabelKey = 'userMenu.open',
ariaLabelDefault = 'Open user menu',
dataMolId = 'user-menu',
className,
}: UserMenuPopoverTriggerProps): React.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.
Provides only the structural concerns (absolute positioning above the
trigger, rounded-xl border frame, the header/nav layout). Cosmetic
choices — width, background, padding, shadow — are per-app: pass them
via className. cn() concatenates (it does not tailwind-merge), so
the panel never bakes a width/background the caller would have to
fight.
function UserMenuPopoverPanel({
children,
className,
ariaLabelKey = 'userMenu.panelLabel',
ariaLabelDefault = 'Account menu',
dataMolId = 'user-menu-panel',
}: UserMenuPopoverPanelProps): React.JSX.Element | null
props— The nav children, className, and aria-label overrides.
Returns: The popover panel, or null 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 auth.logout().
Drop it in as the last child of <UserMenuPopoverPanel>.
function UserMenuPopoverSignOut({
labelKey = 'userMenu.signOut',
labelDefault = 'Sign out',
dataMolId = 'user-menu-sign-out',
className,
}: UserMenuPopoverSignOutProps): React.JSX.Element
props— Label overrides,data-mol-id, and className.
Returns: The sign-out button.
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.
Constants
Badge
Badge component.
const Badge: ForwardRefExoticComponent<
{
children?: ReactNode
color?: ColorVariant | undefined
variant?: 'solid' | 'outline' | 'subtle' | undefined
size?: Size | undefined
rounded?: boolean | undefined
id?: string | undefined
title?: string | undefined
tabIndex?: number | undefined
role?: ElementRole | undefined
'aria-label'?: string | undefined
'aria-labelledby'?: string | undefined
'aria-describedby'?: string | undefined
'aria-hidden'?: boolean | undefined
'aria-disabled'?: boolean | undefined
'aria-expanded'?: boolean | undefined
'aria-selected'?: boolean | undefined
'aria-checked'?: boolean | 'mixed' | undefined
'aria-pressed'?: boolean | 'mixed' | undefined
'aria-invalid'?: boolean | undefined
'aria-required'?: boolean | undefined
'aria-readonly'?: boolean | undefined
'aria-busy'?: boolean | undefined
'aria-live'?: 'off' | 'polite' | 'assertive' | undefined
onClick?: MouseEventHandler | undefined
onDoubleClick?: MouseEventHandler | undefined
onMouseEnter?: MouseEventHandler | undefined
onMouseLeave?: MouseEventHandler | undefined
onFocus?: FocusEventHandler | undefined
onBlur?: FocusEventHandler | undefined
onKeyDown?: KeyboardEventHandler | undefined
onKeyUp?: KeyboardEventHandler | undefined
onKeyPress?: KeyboardEventHandler | undefined
className?: string | undefined
style?: CSSProperties | undefined
testId?: string | undefined
automationId?: string | undefined
disabled?: boolean | undefined
lang?: string | undefined
} & RefAttributes<HTMLSpanElement>
>
Button
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: ForwardRefExoticComponent<
{
children?: ReactNode
variant?: ButtonVariant | undefined
color?: ColorVariant | undefined
size?: ButtonSize | undefined
loading?: boolean | undefined
loadingText?: string | undefined
fullWidth?: boolean | undefined
leftIcon?: ReactNode
rightIcon?: ReactNode
type?: 'button' | 'submit' | 'reset' | undefined
name?: string | undefined
value?: string | undefined
form?: string | undefined
id?: string | undefined
title?: string | undefined
tabIndex?: number | undefined
role?: ElementRole | undefined
'aria-label'?: string | undefined
'aria-labelledby'?: string | undefined
'aria-describedby'?: string | undefined
'aria-hidden'?: boolean | undefined
'aria-disabled'?: boolean | undefined
'aria-expanded'?: boolean | undefined
'aria-selected'?: boolean | undefined
'aria-checked'?: boolean | 'mixed' | undefined
'aria-pressed'?: boolean | 'mixed' | undefined
'aria-invalid'?: boolean | undefined
'aria-required'?: boolean | undefined
'aria-readonly'?: boolean | undefined
'aria-busy'?: boolean | undefined
'aria-live'?: 'off' | 'polite' | 'assertive' | undefined
onClick?: MouseEventHandler | undefined
onDoubleClick?: MouseEventHandler | undefined
onMouseEnter?: MouseEventHandler | undefined
onMouseLeave?: MouseEventHandler | undefined
onFocus?: FocusEventHandler | undefined
onBlur?: FocusEventHandler | undefined
onKeyDown?: KeyboardEventHandler | undefined
onKeyUp?: KeyboardEventHandler | undefined
onKeyPress?: KeyboardEventHandler | undefined
className?: string | undefined
style?: CSSProperties | undefined
testId?: string | undefined
automationId?: string | undefined
disabled?: boolean | undefined
lang?: string | undefined
} & RefAttributes<HTMLButtonElement>
>
Card
Card component.
const Card: ForwardRefExoticComponent<
{
children?: ReactNode
variant?: 'elevated' | 'outlined' | 'filled' | undefined
interactive?: boolean | undefined
padding?: (Size | 'none') | undefined
id?: string | undefined
title?: string | undefined
tabIndex?: number | undefined
role?: ElementRole | undefined
'aria-label'?: string | undefined
'aria-labelledby'?: string | undefined
'aria-describedby'?: string | undefined
'aria-hidden'?: boolean | undefined
'aria-disabled'?: boolean | undefined
'aria-expanded'?: boolean | undefined
'aria-selected'?: boolean | undefined
'aria-checked'?: boolean | 'mixed' | undefined
'aria-pressed'?: boolean | 'mixed' | undefined
'aria-invalid'?: boolean | undefined
'aria-required'?: boolean | undefined
'aria-readonly'?: boolean | undefined
'aria-busy'?: boolean | undefined
'aria-live'?: 'off' | 'polite' | 'assertive' | undefined
onClick?: MouseEventHandler | undefined
onDoubleClick?: MouseEventHandler | undefined
onMouseEnter?: MouseEventHandler | undefined
onMouseLeave?: MouseEventHandler | undefined
onFocus?: FocusEventHandler | undefined
onBlur?: FocusEventHandler | undefined
onKeyDown?: KeyboardEventHandler | undefined
onKeyUp?: KeyboardEventHandler | undefined
onKeyPress?: KeyboardEventHandler | undefined
className?: string | undefined
style?: CSSProperties | undefined
testId?: string | undefined
automationId?: string | undefined
disabled?: boolean | undefined
lang?: string | undefined
} & { 'data-mol-id'?: string } & RefAttributes<HTMLDivElement>
>
CardHeader
Card header component.
const CardHeader: ForwardRefExoticComponent<
{
[x: `data-${string}`]: string | number | boolean | undefined
title?: string | undefined
style?: CSSProperties | undefined
children?: ReactNode
id?: string | undefined
lang?: string | undefined
className?: string | undefined
role?: ElementRole | undefined
'aria-label'?: string | undefined
'aria-labelledby'?: string | undefined
'aria-describedby'?: string | undefined
'aria-hidden'?: AriaBoolean | undefined
'aria-disabled'?: AriaBoolean | undefined
'aria-expanded'?: AriaBoolean | undefined
'aria-selected'?: AriaBoolean | undefined
'aria-checked'?: (AriaBoolean | 'mixed') | undefined
'aria-pressed'?: (AriaBoolean | 'mixed') | undefined
'aria-busy'?: AriaBoolean | undefined
'aria-live'?: 'off' | 'polite' | 'assertive' | undefined
'aria-valuenow'?: number | undefined
'aria-valuemin'?: number | undefined
'aria-valuemax'?: number | undefined
'aria-valuetext'?: string | undefined
'aria-current'?: (AriaBoolean | 'page' | 'step' | 'location' | 'date' | 'time') | undefined
'aria-controls'?: string | undefined
'aria-haspopup'?: (AriaBoolean | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog') | undefined
'aria-modal'?: AriaBoolean | undefined
'aria-invalid'?: AriaBoolean | undefined
'aria-required'?: AriaBoolean | undefined
'aria-readonly'?: AriaBoolean | undefined
'aria-orientation'?: 'horizontal' | 'vertical' | undefined
'aria-sort'?: 'none' | 'ascending' | 'descending' | 'other' | undefined
'aria-level'?: number | undefined
'aria-rowcount'?: number | undefined
'aria-colcount'?: number | undefined
'aria-rowindex'?: number | undefined
'aria-colindex'?: number | undefined
} & RefAttributes<HTMLDivElement>
>
CardTitle
Card title component.
const CardTitle: ForwardRefExoticComponent<
{
[x: `data-${string}`]: string | number | boolean | undefined
title?: string | undefined
style?: CSSProperties | undefined
children?: ReactNode
id?: string | undefined
lang?: string | undefined
className?: string | undefined
role?: ElementRole | undefined
'aria-label'?: string | undefined
'aria-labelledby'?: string | undefined
'aria-describedby'?: string | undefined
'aria-hidden'?: AriaBoolean | undefined
'aria-disabled'?: AriaBoolean | undefined
'aria-expanded'?: AriaBoolean | undefined
'aria-selected'?: AriaBoolean | undefined
'aria-checked'?: (AriaBoolean | 'mixed') | undefined
'aria-pressed'?: (AriaBoolean | 'mixed') | undefined
'aria-busy'?: AriaBoolean | undefined
'aria-live'?: 'off' | 'polite' | 'assertive' | undefined
'aria-valuenow'?: number | undefined
'aria-valuemin'?: number | undefined
'aria-valuemax'?: number | undefined
'aria-valuetext'?: string | undefined
'aria-current'?: (AriaBoolean | 'page' | 'step' | 'location' | 'date' | 'time') | undefined
'aria-controls'?: string | undefined
'aria-haspopup'?: (AriaBoolean | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog') | undefined
'aria-modal'?: AriaBoolean | undefined
'aria-invalid'?: AriaBoolean | undefined
'aria-required'?: AriaBoolean | undefined
'aria-readonly'?: AriaBoolean | undefined
'aria-orientation'?: 'horizontal' | 'vertical' | undefined
'aria-sort'?: 'none' | 'ascending' | 'descending' | 'other' | undefined
'aria-level'?: number | undefined
'aria-rowcount'?: number | undefined
'aria-colcount'?: number | undefined
'aria-rowindex'?: number | undefined
'aria-colindex'?: number | undefined
} & RefAttributes<HTMLHeadingElement>
>
CardDescription
Card description component.
const CardDescription: ForwardRefExoticComponent<
{
[x: `data-${string}`]: string | number | boolean | undefined
title?: string | undefined
style?: CSSProperties | undefined
children?: ReactNode
id?: string | undefined
lang?: string | undefined
className?: string | undefined
role?: ElementRole | undefined
'aria-label'?: string | undefined
'aria-labelledby'?: string | undefined
'aria-describedby'?: string | undefined
'aria-hidden'?: AriaBoolean | undefined
'aria-disabled'?: AriaBoolean | undefined
'aria-expanded'?: AriaBoolean | undefined
'aria-selected'?: AriaBoolean | undefined
'aria-checked'?: (AriaBoolean | 'mixed') | undefined
'aria-pressed'?: (AriaBoolean | 'mixed') | undefined
'aria-busy'?: AriaBoolean | undefined
'aria-live'?: 'off' | 'polite' | 'assertive' | undefined
'aria-valuenow'?: number | undefined
'aria-valuemin'?: number | undefined
'aria-valuemax'?: number | undefined
'aria-valuetext'?: string | undefined
'aria-current'?: (AriaBoolean | 'page' | 'step' | 'location' | 'date' | 'time') | undefined
'aria-controls'?: string | undefined
'aria-haspopup'?: (AriaBoolean | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog') | undefined
'aria-modal'?: AriaBoolean | undefined
'aria-invalid'?: AriaBoolean | undefined
'aria-required'?: AriaBoolean | undefined
'aria-readonly'?: AriaBoolean | undefined
'aria-orientation'?: 'horizontal' | 'vertical' | undefined
'aria-sort'?: 'none' | 'ascending' | 'descending' | 'other' | undefined
'aria-level'?: number | undefined
'aria-rowcount'?: number | undefined
'aria-colcount'?: number | undefined
'aria-rowindex'?: number | undefined
'aria-colindex'?: number | undefined
} & RefAttributes<HTMLParagraphElement>
>
CardContent
Card content component.
const CardContent: ForwardRefExoticComponent<
{
[x: `data-${string}`]: string | number | boolean | undefined
title?: string | undefined
style?: CSSProperties | undefined
children?: ReactNode
id?: string | undefined
lang?: string | undefined
className?: string | undefined
role?: ElementRole | undefined
'aria-label'?: string | undefined
'aria-labelledby'?: string | undefined
'aria-describedby'?: string | undefined
'aria-hidden'?: AriaBoolean | undefined
'aria-disabled'?: AriaBoolean | undefined
'aria-expanded'?: AriaBoolean | undefined
'aria-selected'?: AriaBoolean | undefined
'aria-checked'?: (AriaBoolean | 'mixed') | undefined
'aria-pressed'?: (AriaBoolean | 'mixed') | undefined
'aria-busy'?: AriaBoolean | undefined
'aria-live'?: 'off' | 'polite' | 'assertive' | undefined
'aria-valuenow'?: number | undefined
'aria-valuemin'?: number | undefined
'aria-valuemax'?: number | undefined
'aria-valuetext'?: string | undefined
'aria-current'?: (AriaBoolean | 'page' | 'step' | 'location' | 'date' | 'time') | undefined
'aria-controls'?: string | undefined
'aria-haspopup'?: (AriaBoolean | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog') | undefined
'aria-modal'?: AriaBoolean | undefined
'aria-invalid'?: AriaBoolean | undefined
'aria-required'?: AriaBoolean | undefined
'aria-readonly'?: AriaBoolean | undefined
'aria-orientation'?: 'horizontal' | 'vertical' | undefined
'aria-sort'?: 'none' | 'ascending' | 'descending' | 'other' | undefined
'aria-level'?: number | undefined
'aria-rowcount'?: number | undefined
'aria-colcount'?: number | undefined
'aria-rowindex'?: number | undefined
'aria-colindex'?: number | undefined
} & RefAttributes<HTMLDivElement>
>
CardFooter
Card footer component.
const CardFooter: ForwardRefExoticComponent<
{
[x: `data-${string}`]: string | number | boolean | undefined
title?: string | undefined
style?: CSSProperties | undefined
children?: ReactNode
id?: string | undefined
lang?: string | undefined
className?: string | undefined
role?: ElementRole | undefined
'aria-label'?: string | undefined
'aria-labelledby'?: string | undefined
'aria-describedby'?: string | undefined
'aria-hidden'?: AriaBoolean | undefined
'aria-disabled'?: AriaBoolean | undefined
'aria-expanded'?: AriaBoolean | undefined
'aria-selected'?: AriaBoolean | undefined
'aria-checked'?: (AriaBoolean | 'mixed') | undefined
'aria-pressed'?: (AriaBoolean | 'mixed') | undefined
'aria-busy'?: AriaBoolean | undefined
'aria-live'?: 'off' | 'polite' | 'assertive' | undefined
'aria-valuenow'?: number | undefined
'aria-valuemin'?: number | undefined
'aria-valuemax'?: number | undefined
'aria-valuetext'?: string | undefined
'aria-current'?: (AriaBoolean | 'page' | 'step' | 'location' | 'date' | 'time') | undefined
'aria-controls'?: string | undefined
'aria-haspopup'?: (AriaBoolean | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog') | undefined
'aria-modal'?: AriaBoolean | undefined
'aria-invalid'?: AriaBoolean | undefined
'aria-required'?: AriaBoolean | undefined
'aria-readonly'?: AriaBoolean | undefined
'aria-orientation'?: 'horizontal' | 'vertical' | undefined
'aria-sort'?: 'none' | 'ascending' | 'descending' | 'other' | undefined
'aria-level'?: number | undefined
'aria-rowcount'?: number | undefined
'aria-colcount'?: number | undefined
'aria-rowindex'?: number | undefined
'aria-colindex'?: number | undefined
} & RefAttributes<HTMLDivElement>
>
ConfirmButton
Confirms a destructive action and forwards its host handle.
const ConfirmButton: ForwardRefExoticComponent<ConfirmButtonProps & RefAttributes<ElementHandle>>
Dropdown
Opens a list of options and forwards the menu's mounted host.
const Dropdown: ForwardRefExoticComponent<DropdownProps<string> & RefAttributes<ElementHandle>>
DropdownLabel
Labels a group of menu items.
const DropdownLabel: ForwardRefExoticComponent<
{ children: ReactNode; className?: string } & RefAttributes<ElementHandle>
>
DropdownSeparator
Separates groups of menu items.
const DropdownSeparator: ForwardRefExoticComponent<
{ className?: string } & RefAttributes<ElementHandle>
>
EmptyState
EmptyState component.
Displays a centered placeholder with an optional icon, title, description, and a primary action when a list or section has no content.
const EmptyState: ForwardRefExoticComponent<
{
icon?: ReactNode
title: string
description?: string | undefined
action?: ReactNode
className?: string | undefined
style?: CSSProperties | undefined
testId?: string | undefined
automationId?: string | undefined
disabled?: boolean | undefined
} & RefAttributes<HTMLDivElement>
>
FloatingInput
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 htmlFor> (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 useId() when the caller doesn't pass one, mirroring
Input/Select/Textarea's id-collision fix.
const FloatingInput: ForwardRefExoticComponent<
FloatingInputProps & Pick<TextFieldProps, 'onValueChange'> & RefAttributes<HTMLInputElement>
>
Form
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: React.ForwardRefExoticComponent<ReactFormProps & React.RefAttributes<HTMLFormElement>>
FormField
Form field wrapper component.
const FormField: React.ForwardRefExoticComponent<
{
children?: React.ReactNode
label?: string | undefined
name?: string | undefined
error?: string | undefined
hint?: string | undefined
required?: boolean | undefined
id?: string | undefined
title?: string | undefined
tabIndex?: number | undefined
role?: ElementRole | undefined
'aria-label'?: string | undefined
'aria-labelledby'?: string | undefined
'aria-describedby'?: string | undefined
'aria-hidden'?: boolean | undefined
'aria-disabled'?: boolean | undefined
'aria-expanded'?: boolean | undefined
'aria-selected'?: boolean | undefined
'aria-checked'?: boolean | 'mixed' | undefined
'aria-pressed'?: boolean | 'mixed' | undefined
'aria-invalid'?: boolean | undefined
'aria-required'?: boolean | undefined
'aria-readonly'?: boolean | undefined
'aria-busy'?: boolean | undefined
'aria-live'?: 'off' | 'polite' | 'assertive' | undefined
onClick?: MouseEventHandler | undefined
onDoubleClick?: MouseEventHandler | undefined
onMouseEnter?: MouseEventHandler | undefined
onMouseLeave?: MouseEventHandler | undefined
onFocus?: FocusEventHandler | undefined
onBlur?: FocusEventHandler | undefined
onKeyDown?: KeyboardEventHandler | undefined
onKeyUp?: KeyboardEventHandler | undefined
onKeyPress?: KeyboardEventHandler | undefined
className?: string | undefined
style?: CSSProperties | undefined
testId?: string | undefined
automationId?: string | undefined
disabled?: boolean | undefined
lang?: string | undefined
} & React.RefAttributes<HTMLDivElement>
>
Label
Label component.
It takes a label element's React attributes and renders the renderer-neutral label element.
role and aria-invalid take the types that element takes (the ones every kit component's
props declare); the other attributes reach the element as given.
const Label: React.ForwardRefExoticComponent<
Omit<React.LabelHTMLAttributes<HTMLLabelElement>, 'role' | 'aria-invalid'> & {
role?: ElementRole
'aria-invalid'?: AriaBoolean
required?: boolean
} & React.RefAttributes<HTMLLabelElement>
>
Input
Input component.
const Input: ForwardRefExoticComponent<
{
onChange?: EventHandler<KitFieldChangeEvent> | undefined
type?: InputType | undefined
size?: Size | undefined
align?: 'left' | 'center' | undefined
label?: string | undefined
error?: string | undefined
hint?: string | undefined
leftElement?: ReactNode
rightElement?: ReactNode
clearable?: boolean | undefined
onClear?: (() => void) | undefined
clearLabel?: string | undefined
name?: string | undefined
value?: (string | number | readonly string[]) | undefined
defaultValue?: (string | number | readonly string[]) | undefined
placeholder?: string | undefined
required?: boolean | undefined
readOnly?: boolean | undefined
autoFocus?: boolean | undefined
autoComplete?: string | undefined
maxLength?: number | undefined
minLength?: number | undefined
pattern?: string | undefined
onInput?: FormEventHandler | undefined
id?: string | undefined
title?: string | undefined
tabIndex?: number | undefined
role?: ElementRole | undefined
'aria-label'?: string | undefined
'aria-labelledby'?: string | undefined
'aria-describedby'?: string | undefined
'aria-hidden'?: boolean | undefined
'aria-disabled'?: boolean | undefined
'aria-expanded'?: boolean | undefined
'aria-selected'?: boolean | undefined
'aria-checked'?: boolean | 'mixed' | undefined
'aria-pressed'?: boolean | 'mixed' | undefined
'aria-invalid'?: boolean | undefined
'aria-required'?: boolean | undefined
'aria-readonly'?: boolean | undefined
'aria-busy'?: boolean | undefined
'aria-live'?: 'off' | 'polite' | 'assertive' | undefined
onClick?: MouseEventHandler | undefined
onDoubleClick?: MouseEventHandler | undefined
onMouseEnter?: MouseEventHandler | undefined
onMouseLeave?: MouseEventHandler | undefined
onFocus?: FocusEventHandler | undefined
onBlur?: FocusEventHandler | undefined
onKeyDown?: KeyboardEventHandler | undefined
onKeyUp?: KeyboardEventHandler | undefined
onKeyPress?: KeyboardEventHandler | undefined
className?: string | undefined
style?: CSSProperties | undefined
testId?: string | undefined
automationId?: string | undefined
disabled?: boolean | undefined
lang?: string | undefined
onValueChange?: ((value: string) => void) | undefined
} & RefAttributes<HTMLInputElement>
>
Container
Container component.
const Container: ForwardRefExoticComponent<
{
children?: ReactNode
maxWidth?: 'sm' | 'md' | 'lg' | 'xl' | '2xl' | 'full' | string | undefined
centered?: boolean | undefined
paddingX?: (Size | string) | undefined
id?: string | undefined
title?: string | undefined
tabIndex?: number | undefined
role?: ElementRole | undefined
'aria-label'?: string | undefined
'aria-labelledby'?: string | undefined
'aria-describedby'?: string | undefined
'aria-hidden'?: boolean | undefined
'aria-disabled'?: boolean | undefined
'aria-expanded'?: boolean | undefined
'aria-selected'?: boolean | undefined
'aria-checked'?: boolean | 'mixed' | undefined
'aria-pressed'?: boolean | 'mixed' | undefined
'aria-invalid'?: boolean | undefined
'aria-required'?: boolean | undefined
'aria-readonly'?: boolean | undefined
'aria-busy'?: boolean | undefined
'aria-live'?: 'off' | 'polite' | 'assertive' | undefined
onClick?: MouseEventHandler | undefined
onDoubleClick?: MouseEventHandler | undefined
onMouseEnter?: MouseEventHandler | undefined
onMouseLeave?: MouseEventHandler | undefined
onFocus?: FocusEventHandler | undefined
onBlur?: FocusEventHandler | undefined
onKeyDown?: KeyboardEventHandler | undefined
onKeyUp?: KeyboardEventHandler | undefined
onKeyPress?: KeyboardEventHandler | undefined
className?: string | undefined
style?: CSSProperties | undefined
testId?: string | undefined
automationId?: string | undefined
disabled?: boolean | undefined
lang?: string | undefined
} & RefAttributes<HTMLDivElement>
>
Flex
Flex container component.
const Flex: ForwardRefExoticComponent<
{
children?: ReactNode
direction?: 'row' | 'column' | 'row-reverse' | 'column-reverse' | undefined
justify?: 'start' | 'end' | 'center' | 'between' | 'around' | 'evenly' | undefined
align?: 'start' | 'end' | 'center' | 'baseline' | 'stretch' | undefined
wrap?: 'wrap' | 'nowrap' | 'wrap-reverse' | undefined
gap?: (Size | string | number) | undefined
id?: string | undefined
title?: string | undefined
tabIndex?: number | undefined
role?: ElementRole | undefined
'aria-label'?: string | undefined
'aria-labelledby'?: string | undefined
'aria-describedby'?: string | undefined
'aria-hidden'?: boolean | undefined
'aria-disabled'?: boolean | undefined
'aria-expanded'?: boolean | undefined
'aria-selected'?: boolean | undefined
'aria-checked'?: boolean | 'mixed' | undefined
'aria-pressed'?: boolean | 'mixed' | undefined
'aria-invalid'?: boolean | undefined
'aria-required'?: boolean | undefined
'aria-readonly'?: boolean | undefined
'aria-busy'?: boolean | undefined
'aria-live'?: 'off' | 'polite' | 'assertive' | undefined
onClick?: MouseEventHandler | undefined
onDoubleClick?: MouseEventHandler | undefined
onMouseEnter?: MouseEventHandler | undefined
onMouseLeave?: MouseEventHandler | undefined
onFocus?: FocusEventHandler | undefined
onBlur?: FocusEventHandler | undefined
onKeyDown?: KeyboardEventHandler | undefined
onKeyUp?: KeyboardEventHandler | undefined
onKeyPress?: KeyboardEventHandler | undefined
className?: string | undefined
style?: CSSProperties | undefined
testId?: string | undefined
automationId?: string | undefined
disabled?: boolean | undefined
lang?: string | undefined
} & RefAttributes<HTMLDivElement>
>
Grid
Grid container component.
const Grid: ForwardRefExoticComponent<
{
children?: ReactNode
columns?: number | string | undefined
rows?: number | string | undefined
gap?: (Size | string | number) | undefined
columnGap?: (Size | string | number) | undefined
rowGap?: (Size | string | number) | undefined
id?: string | undefined
title?: string | undefined
tabIndex?: number | undefined
role?: ElementRole | undefined
'aria-label'?: string | undefined
'aria-labelledby'?: string | undefined
'aria-describedby'?: string | undefined
'aria-hidden'?: boolean | undefined
'aria-disabled'?: boolean | undefined
'aria-expanded'?: boolean | undefined
'aria-selected'?: boolean | undefined
'aria-checked'?: boolean | 'mixed' | undefined
'aria-pressed'?: boolean | 'mixed' | undefined
'aria-invalid'?: boolean | undefined
'aria-required'?: boolean | undefined
'aria-readonly'?: boolean | undefined
'aria-busy'?: boolean | undefined
'aria-live'?: 'off' | 'polite' | 'assertive' | undefined
onClick?: MouseEventHandler | undefined
onDoubleClick?: MouseEventHandler | undefined
onMouseEnter?: MouseEventHandler | undefined
onMouseLeave?: MouseEventHandler | undefined
onFocus?: FocusEventHandler | undefined
onBlur?: FocusEventHandler | undefined
onKeyDown?: KeyboardEventHandler | undefined
onKeyUp?: KeyboardEventHandler | undefined
onKeyPress?: KeyboardEventHandler | undefined
className?: string | undefined
style?: CSSProperties | undefined
testId?: string | undefined
automationId?: string | undefined
disabled?: boolean | undefined
lang?: string | undefined
} & RefAttributes<HTMLDivElement>
>
Spacer
Spacer component.
const Spacer: ForwardRefExoticComponent<SpacerProps & RefAttributes<HTMLDivElement>>
Modal
A blocking dialog. The inner dialog receives the forwarded ref and caller attributes,
including overrides for role, tabIndex and aria-labelledby. The platform owns
the dialog's focus, dismissal order and scroll lock.
const Modal: ForwardRefExoticComponent<
ModalProps & { 'data-mol-id'?: string } & RefAttributes<HTMLDivElement>
>
OptimisticToggleButton
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.
Render this button after the record loads, give it a key per record, and keep it mounted
during same-record refetches. Keep authorization and self-record checks in the app.
disabled is for those permissions, never for a pending save. Local UI switches use Button
or Switch without a server commit.
const OptimisticToggleButton: React.ForwardRefExoticComponent<
OptimisticToggleButtonProps & React.RefAttributes<HTMLButtonElement>
>
PageHeader
PageHeader component.
Renders a page title with optional breadcrumb trail, description, and action buttons for a consistent page heading area.
const PageHeader: React.ForwardRefExoticComponent<
{
title: string
description?: string | undefined
actions?: React.ReactNode
breadcrumbs?: Array<{ label: string; href?: string }> | undefined
className?: string | undefined
style?: CSSProperties | undefined
testId?: string | undefined
automationId?: string | undefined
disabled?: boolean | undefined
} & React.RefAttributes<HTMLDivElement>
>
PageShell
PageShell component.
Provides the top-level layout for authenticated pages with an optional collapsible sidebar, a top bar, and a scrollable main content area.
const PageShell: ForwardRefExoticComponent<
{
sidebar?: ReactNode
topbar?: ReactNode
sidebarCollapsed?: boolean | undefined
onSidebarToggle?: (() => void) | undefined
children?: ReactNode
className?: string | undefined
style?: CSSProperties | undefined
testId?: string | undefined
automationId?: string | undefined
disabled?: boolean | undefined
} & RefAttributes<HTMLDivElement>
>
Progress
Progress component.
const Progress: React.ForwardRefExoticComponent<ProgressProps & React.RefAttributes<HTMLDivElement>>
ResponsiveAppShell
The responsive app shell family — see the root component and the module docs for the full contract.
Consumed as <ResponsiveAppShell.TopBar />, .Sidebar, .Drawer and
.Content inside <ResponsiveAppShell>; each is also exported as a named
component (ResponsiveAppShellTopBar, …) for star-import consumers.
const ResponsiveAppShell: typeof ResponsiveAppShellBase & {
TopBar: typeof ResponsiveAppShellTopBar
Sidebar: typeof ResponsiveAppShellSidebar
Drawer: typeof ResponsiveAppShellDrawer
Content: typeof ResponsiveAppShellContent
}
Separator
Separator component.
const Separator: React.ForwardRefExoticComponent<
SeparatorProps & React.RefAttributes<HTMLDivElement>
>
Skeleton
Skeleton component.
const Skeleton: React.ForwardRefExoticComponent<SkeletonProps & React.RefAttributes<HTMLDivElement>>
SkeletonText
Skeleton text line.
const SkeletonText: React.ForwardRefExoticComponent<
{ lines?: number; className?: string } & React.RefAttributes<HTMLDivElement>
>
SkeletonCircle
Skeleton circle (avatar placeholder).
const SkeletonCircle: React.ForwardRefExoticComponent<
{ size?: number; className?: string } & React.RefAttributes<HTMLDivElement>
>
Toast
Renders a notification and forwards its renderer's host handle.
const Toast: ForwardRefExoticComponent<ToastProps & RefAttributes<ElementHandle>>
ToastContainer
Positions notifications in a portal and forwards its host handle.
const ToastContainer: ForwardRefExoticComponent<ToastContainerProps & RefAttributes<ElementHandle>>
useToast
Adds and removes notifications using React-renderable content.
const useToast: () => ToastContextValue<ToastProps>
Tooltip
Displays supplemental content and forwards the tooltip's host handle while visible.
const Tooltip: ForwardRefExoticComponent<TooltipProps & RefAttributes<ElementHandle>>
FileField
Renders a browser chooser with its own target or separately rendered triggers.
const FileField: ForwardRefExoticComponent<
FileFieldProps<ReactNode> & RefAttributes<FileFieldHandle>
>
Accordion
Accordion with its browser root ref.
const Accordion: ForwardRefExoticComponent<AccordionProps & RefAttributes<HTMLDivElement>>
Alert
Alert with its browser root ref.
const Alert: ForwardRefExoticComponent<
AlertProps & { live?: boolean } & RefAttributes<HTMLDivElement>
>
Avatar
Avatar with its browser root ref.
const Avatar: ForwardRefExoticComponent<AvatarProps & RefAttributes<HTMLDivElement>>
Checkbox
Checkbox with its browser input ref.
const Checkbox: ForwardRefExoticComponent<CheckboxProps & RefAttributes<HTMLInputElement>>
Pagination
Pagination with its navigation element ref.
const Pagination: ForwardRefExoticComponent<PaginationProps & RefAttributes<HTMLElement>>
RadioGroup
Radio group with its browser root ref.
const RadioGroup: ForwardRefExoticComponent<RadioGroupProps & RefAttributes<HTMLDivElement>>
Select
Select with its browser select element ref.
const Select: ForwardRefExoticComponent<ReactSelectProps & RefAttributes<HTMLSelectElement>>
Spinner
Loading indicator with its browser root ref.
const Spinner: ForwardRefExoticComponent<
SpinnerProps & { 'data-mol-id'?: string } & RefAttributes<HTMLDivElement>
>
Switch
Switch with its browser button ref.
const Switch: ForwardRefExoticComponent<SwitchProps & RefAttributes<HTMLButtonElement>>
Table
Data table with its browser table element ref.
const Table: ForwardRefExoticComponent<
TableProps<Record<string, unknown>> & RefAttributes<HTMLTableElement>
>
Tabs
Tabs with their browser root ref.
const Tabs: ForwardRefExoticComponent<TabsProps & RefAttributes<HTMLDivElement>>
Textarea
Textarea with its browser textarea element ref.
const Textarea: ForwardRefExoticComponent<TextareaProps & RefAttributes<HTMLTextAreaElement>>
Injection Notes
Requirements
Peer dependencies:
@molecule/app-filesystem^1.1.0@molecule/app-i18n^1.3.0@molecule/app-icons^1.0.1@molecule/app-react^4.17.0 || ^5.0.0@molecule/app-ui^1.18.0@molecule/app-ui-react-native^2.3.0 (optional)react^18.0.0 || ^19.0.0react-dom^18.0.0 || ^19.0.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-react@molecule/app-react-ui-kit-components@molecule/app-ui@molecule/app-ui-react-native(optional)reactreact-dom
Wiring prerequisites — get these right before debugging anything else:
- A ClassMap bond must be set before first render. Every component resolves styling via
getClassMap()from@molecule/app-ui, which THROWS ("No UIClassMap has been set") untilsetClassMap(...)runs with a bond like@molecule/app-ui-tailwind. Scaffolded apps do this inbonds/index.ts— keep that import first inmain.tsx. - Some components require molecule providers from
@molecule/app-reactand throw without them:UserMenu,UserMenuPopover,LanguagePicker,SidebarUserCard,AuthGuard, andThemeToggleneedI18nProvider(viaMoleculeProvider i18n={...});ThemeTogglealso needsThemeProvider;AuthGuardalso needsAuthProvider. The primitive components (Button, Modal, Input, …) need only the ClassMap. - Router-linked components (
UserMenu,UserMenuPopover,SidebarUserCard,Dropdown,ResponsiveAppShell,AuthGuard) read the router through@molecule/app-react(useLocation,useRouterInstance,RoutedView), so they work under any routing bond and import no router library. They need the router component of the app's routing bond (BrowserRouterfrom@molecule/app-routing-react-router) above them, and throw an error naming it without one. UserMenupanel content ischildren(rendered inside the popover, withPanelClose/usePanelCloseavailable) — there is norenderPanelprop.Iconnames are kebab-caseIconNames from@molecule/app-icons— an unknown name is a runtime error, not a blank. Extend viaCustomIconNamesaugmentation, never raw SVG.- Name collisions with feature packages — several feature packages export a
same-named component; import from the package whose props/behavior you want:
EmptyState— also@molecule/app-empty-state-react(adds an icon badge, per-brandclassName/dataMolId, and a companion<CtaCard>). THIS one is the primitive icon/title/description/action variant.PageHeader— also@molecule/app-page-chrome-react(addssubtitle,icon,meta,emphasis+ a<HeroSection>). THIS one takestitle/description/actions/breadcrumbs.Pagination— the low-level page-window control (no "showing X of Y" text, no page-size selector); for those use<PaginationBar>from@molecule/app-pagination-bar-react.
A11y contracts worth knowing before you debug "it doesn't look like it's doing anything" on these components:
Modalimplements the WAI-ARIA APG dialog pattern: opening moves focus to the first focusable element inside the dialog (or the dialog itself when it has none); Tab/Shift+Tab are trapped inside; closing restores focus to whatever opened it. Stacked dialogs (a confirm above a drawer) register on a module-level 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.centered={false}top-anchors the dialog instead of vertically centering it (an inline-style exception —UIClassMaphas nodialogWrapper({ centered })resolver yet).Dropdownimplements the WAI-ARIA APG menu-button pattern: thetriggeris made a real, keyboard-operable control (cloned witharia-haspopup/aria-expanded/aria-controlswhen it's a single element; wrapped in arole="button" tabIndex={0}container otherwise). Enter/Space/ArrowDown open the menu and focus the first item (ArrowUp opens to the last); once open, ArrowUp/Down/Home/End roving-navigate themenuitems, Escape closes and returns focus to the trigger, and Tab closes the menu in sync with focus leaving it (native menus don't trap Tab).width="trigger"never renders literalwidth: 'trigger'CSS on the not-yet-measurable first-open frame — it renders unset instead.Tooltiprequires a single element aschildrenfor its content to be programmatically associated (aria-describedby, injected viacloneElement) with the actually-focused/hovered control — a non-elementchildrenstill shows visually but without that association.hasArrowrenders a small themed pointer at the resolvedplacement.Toastpauses its auto-dismiss countdown on hover AND focus (WCAG 2.2.1) and resumes with whatever time was left. The announced role followsstatus:warning/errorget the assertiverole="alert"; every other status gets the politerole="status"so a routine confirmation doesn't interrupt a screen reader mid-sentence.Alerttakes aliveprop (defaulttrue, matching the previous unconditional behavior):live={false}switches it from the assertiverole="alert"to the politerole="status"for a banner that's part of the page's normal (not dynamically-appearing) content.UserMenuPopover*:UserMenuPopoverPanelis a disclosure region (aria-expanded+aria-controlson the trigger, no role on the panel itself), NOTrole="menu"— it renders a header plus a<nav>of arbitrary links, which is invalid content forrole="menu"(that role may contain ONLYmenuitemdescendants).Switchdispatches a REAL nativechangeEvent through its hidden checkbox —event.preventDefault(),event.currentTarget, andevent.stopPropagation()all behave like they do for any native input (previously the handler received a synthesized{ target: { checked } }object that crashed on any of those).Tabsimplements the WAI-ARIA APG tabs pattern: roving tabindex (only the active tab is in the Tab order) with ArrowLeft/ArrowRight/ Home/End moving focus and selection.FormFieldwiresaria-describedbyfrom its error paragraph onto the child input automatically (falling back to auseId()-derived id when nonameprop is given) — don't duplicate the association by hand.Progressclampsaria-valuenowinto[0, max]to match the clamped visual bar, so out-of-range values never announce impossible percentages.TextareaautoResizealso works uncontrolled (defaultValue+ user typing): it listens toinputevents rather than only reacting to the controlledvalueprop.- React Native uses the
@molecule/app-ui-react-nativepeer for elements and overlays. Native scaffolds include that kit.FileFielduses the browser chooser on web and the bonded file picker on iOS and Android. Expo scaffolds wire the Expo picker.
Translations
Translation strings are provided by @molecule/app-locales-ui.