Interfaces
BadgeProps
Properties
ConfirmDialogProps
Properties
ConfirmOptions
Properties
ConfirmProviderProps
Properties
| Property | Type | Description |
|---|---|---|
children | ReactNode | - |
dialogClassName? | string | Forwarded to the rendered <ConfirmDialog>. |
CopyButtonProps
Properties
JsonViewProps
Properties
SegmentedControlProps
Type Parameters
| Type Parameter |
|---|
T extends string |
Properties
| Property | Type | Description |
|---|---|---|
ariaLabel? | string | Accessible label for the radiogroup. |
className? | string | Forwarded to the container. |
onChange | (value: T) => void | Fired with the new value when a segment is clicked. |
options | readonly SegmentedOption<T>[] | The selectable segments, rendered left-to-right. |
value | T | The currently-selected value. |
SegmentedOption
Type Parameters
| Type Parameter |
|---|
T extends string |
Properties
ToastInput
Extended by
Properties
| Property | Type | Description |
|---|---|---|
body? | ReactNode | - |
duration? | number | Auto-dismiss after this many ms. 0 makes the toast sticky; default is 5000. |
kind? | ToastKind | - |
title | string | - |
ToastProviderProps
Properties
ToastRecord
Extends
Properties
| Property | Type | Description |
|---|---|---|
body? | ReactNode | - |
duration? | number | Auto-dismiss after this many ms. 0 makes the toast sticky; default is 5000. |
id | string | - |
kind? | ToastKind | - |
title | string | - |
UpdateHighlight
Properties
| Property | Type |
|---|---|
cycle | 0 | 1 |
kind | UpdateHighlightKind |
UseContainerSizeOptions
Properties
UseUpdateHighlightsOptions
Type Parameters
| Type Parameter |
|---|
T |
Properties
| Property | Type |
|---|---|
durationMs? | number |
entries | ReadonlyMap<string, T> |
equals? | (previous: T, next: T) => boolean |
ready? | boolean |
scope | string |
VirtualListProps
Type Parameters
| Type Parameter |
|---|
T |
Properties
Type Aliases
ConfirmFn()
type ConfirmFn = (options: ConfirmOptions) => Promise<boolean>;
Parameters
| Parameter | Type |
|---|---|
options | ConfirmOptions |
Returns
Promise<boolean>
ContainerSize
type ContainerSize = "narrow" | "medium" | "wide";
ToastKind
type ToastKind = "info" | "success" | "warning" | "error";
UpdateHighlightKind
type UpdateHighlightKind = "added" | "modified";
Functions
Badge()
function Badge(__namedParameters: BadgeProps): Element;
Headless pill / tag. Renders an inline <span> carrying
data-pyric-badge and (when kind is set) data-pyric-badge-kind
so consumers can style categories with attribute selectors. Ships
no visual styling of its own.
Parameters
| Parameter | Type |
|---|---|
__namedParameters | BadgeProps |
Returns
Element
ConfirmDialog()
function ConfirmDialog(__namedParameters: ConfirmDialogProps): ReactPortal;
Headless confirmation dialog. Hand-rolled (we evaluated Radix Dialog at M4 but Radix’s Presence + Portal stack doesn’t render under our bun:test + JSDOM env — see plan section 7 risk #1).
Provides:
- Portal to
document.body(so the dialog can escape parent stacking contexts) - Escape-to-close
- Overlay click to close
- ARIA
role="dialog" aria-modal="true"wiring - Focus restoration to the previously-focused element on close
- Initial focus on the confirm button when opening
Ships no visual CSS. Consumers style via the structural
data-pyric-* attributes.
Parameters
| Parameter | Type |
|---|---|
__namedParameters | ConfirmDialogProps |
Returns
ReactPortal
ConfirmProvider()
function ConfirmProvider(__namedParameters: ConfirmProviderProps): Element;
Mounts a single managed <ConfirmDialog> and exposes the
imperative confirm() API through context. Scoped — multiple
providers can coexist in different subtrees, each managing its
own dialog.
Parameters
| Parameter | Type |
|---|---|
__namedParameters | ConfirmProviderProps |
Returns
Element
CopyButton()
function CopyButton(__namedParameters: CopyButtonProps): Element;
Headless copy-to-clipboard button. Exposes its copied state via
the data-copied attribute on the underlying <button> so
consumers can style the success state with [data-copied] (or
data-[copied]:bg-green-500 in Tailwind’s arbitrary-variant
syntax). Ships no visual styling of its own.
Parameters
| Parameter | Type |
|---|---|
__namedParameters | CopyButtonProps |
Returns
Element
JsonView()
function JsonView(__namedParameters: JsonViewProps): Element;
Headless collapsible JSON tree. One structural step above a
<pre> dump: object/array nodes are independently expandable, but
there’s no editing and no syntax-color theme — just data-pyric-*
hooks for the consumer to style.
Styling hooks:
[data-pyric-ui="json-view"]— root[data-pyric-json-node]— every node, withdata-pyric-json-type[data-pyric-json-toggle]— the expand/collapse button (containers only)[data-pyric-json-node][data-pyric-collapsed]— a collapsed container[data-pyric-json-key]— the key/index label[data-pyric-json-value]— a primitive value[data-pyric-json-summary]— the{…}/[…]placeholder when collapsed
Parameters
| Parameter | Type |
|---|---|
__namedParameters | JsonViewProps |
Returns
Element
SegmentedControl()
function SegmentedControl<T>(__namedParameters: SegmentedControlProps<T>): Element;
Headless segmented control — a single-select group of pill buttons that reads as one widget. Wired as an ARIA radiogroup.
Ships no visual styling. Consumers style via:
[data-pyric-ui="segmented-control"]— the container[data-pyric-segment]— each option button[data-pyric-segment][data-pyric-active]— the selected one[data-pyric-segment-tone="…"]— tone-tinted options
Type Parameters
| Type Parameter |
|---|
T extends string |
Parameters
| Parameter | Type |
|---|---|
__namedParameters | SegmentedControlProps<T> |
Returns
Element
ToastProvider()
function ToastProvider(__namedParameters: ToastProviderProps): Element;
Toast queue host. Mounts a single live region into document.body
via portal and exposes the imperative API via context. Scoped —
a subtree can host its own provider for isolated queues if needed.
Headless: every node carries structural data-* attributes, no
shipped CSS. Auto-dismiss timers are kept per-toast.
Parameters
| Parameter | Type |
|---|---|
__namedParameters | ToastProviderProps |
Returns
Element
useConfirm()
function useConfirm(): ConfirmFn;
Imperative confirmation hook. Returns a function that opens the
provider-managed dialog and resolves to true on confirm, false
on cancel/dismiss.
const confirm = useConfirm(); const ok = await confirm({ title: ‘Delete?’, destructive: true }); if (ok) await deleteDoc(ref);
Requires a <ConfirmProvider> ancestor.
Returns
useContainerSize()
function useContainerSize<T>(options?: UseContainerSizeOptions): {
ref: RefObject<T>;
size: ContainerSize;
};
Container-query helper. Returns the current size bucket
('narrow' | 'medium' | 'wide') of the element pointed at by
the returned ref. Re-fires on resize via ResizeObserver.
const { ref, size } = useContainerSize(); return
Headless: the consumer styles via [data-size='narrow']
selectors. The library’s feature components use this hook to
stamp their roots with data-size, which is the policy the
survey’s modern-CSS subsection landed on (no viewport media
queries, no library-side breakpoints — push the threshold
decision to the consumer via data attributes).
Type Parameters
| Type Parameter | Default type |
|---|---|
T extends HTMLElement | HTMLDivElement |
Parameters
| Parameter | Type |
|---|---|
options? | UseContainerSizeOptions |
Returns
{
ref: RefObject<T>;
size: ContainerSize;
}
ref
ref: RefObject<T>;
size
size: ContainerSize;
useToast()
function useToast(): ToastContextValue;
Imperative toast hook. Returns { toast, dismiss, toasts }.
const { toast } = useToast(); toast({ title: ‘Saved.’, kind: ‘success’ });
Requires a <ToastProvider> ancestor.
Returns
ToastContextValue
useUpdateHighlights()
function useUpdateHighlights<T>(__namedParameters: UseUpdateHighlightsOptions<T>): ReadonlyMap<string, UpdateHighlight>;
Tracks transient additions and modifications between keyed snapshots. The first ready snapshot in each scope is a silent baseline.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
__namedParameters | UseUpdateHighlightsOptions<T> |
Returns
ReadonlyMap<string, UpdateHighlight>
VirtualList()
function VirtualList<T>(__namedParameters: VirtualListProps<T>): Element;
Thin wrapper around @tanstack/react-virtual. Renders a
scrollable container with absolutely-positioned rows, drawing
only the rows currently in view (plus overscan neighbors).
Headless — no shipped CSS beyond what’s structurally required
to position rows (the inner spacer’s height + each row’s
position: absolute; top: …px). Consumers style via the
className prop and standard CSS targeting [data-pyric-ui= "virtual-list"] on the scroll container and
[data-pyric-virtual-row] on each row.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
__namedParameters | VirtualListProps<T> |
Returns
Element