Skip to content
K

API Reference

Public v0.1 API surface by package.

This page records the v0.1 public API shape. Rust crates remain internal and are not published to crates.io for v0.1.

@naos-ui/core

ExportStabilityNotes
state()PublicWritable local state primitive.
computed()PublicDerived read-only value.
effect()PublicLifecycle-aware effect and cleanup.
event()PublicTyped CustomEvent dispatch helper.
on()PublicTyped DOM listener helper with listener options and invocation-scoped abort signals.
host()PublicCurrent custom element, props, lifecycle signals, and update/task handle.
formControl()ExperimentalCompiler-recognized form association helper for generated Custom Elements.
ShowPublicStatic conditional rendering primitive.
ComponentOptionsPublicFlat styles metadata for component CSS.

@naos-ui/runtime

Tiny platform helper runtime for generated output: events, scheduling, and hydration helpers. It is not a reconciler, virtual DOM, component runtime, or framework adapter.

@naos-ui/router

Optional browser-side router for Custom Element app shells.

ExportStabilityNotes
defineRoutes()ExperimentalPreserves route-table inference for path params.
createRouter()ExperimentalCreates a router that mounts custom-element route targets into an outlet.
redirect()ExperimentalCreates an action redirect result for route actions.
NaosRouterExperimentalEventTarget-backed router instance with start, stop, navigate, replace, submit, href, prefetch, back, forward, and reload.

Mounted route elements receive an naosRoute property with the current route, URL, params, search params, loader data, action data, navigation type, and abort signal. Route records may define loader and action; native forms opt into action handling with data-naos-action. The router intercepts only same-origin anchors and explicit action forms it can handle and falls back to ordinary browser behavior for external links, downloads, targets, and modified clicks.

@naos-ui/primitives

Experimental primitive Custom Elements authored in Naos .wc.tsx and compiled for package distribution.

All primitives remain experimental. The package exposes Naos elements only; Zag machines and adapter helpers stay private under the package internals.

Actions And Structure

ElementKey attributesEventsNotes
<naos-button>variant, disabled, labelnaos-pressNative button action primitive with slots, parts, and CSS custom properties.
<naos-button-group>orientation, labelNoneStructural grouping for related actions.
<naos-field>label, hint, status, invalidNoneLabel, hint, status, and layout shell.

Forms And Inputs

ElementKey attributesEventsForm behavior
<naos-checkbox>name, value, checked, indeterminate, disabled, labelnaos-changeForm-associated; supports submit, reset, FormData, and disabled fieldset propagation.
<naos-toggle>name, value, pressed, disabled, labelnaos-changeForm-associated pressed/on-off control.
<naos-switch>name, value, checked, disabled, labelnaos-changeZag-backed switch with native form integration.
<naos-number-input>name, value, min, max, step, disabled, labelnaos-changeZag-backed spinbutton behavior with form integration.
<naos-slider>name, value, min, max, step, disabled, labelnaos-changeZag-backed single-value slider with pointer and keyboard behavior.
<naos-pin-input>name, value, count, otp, disabled, labelnaos-change, naos-complete, naos-invalidMulti-field code input with paste and keyboard behavior.
<naos-tags-input>name, value, delimiter, max, allow-duplicates, disabled, labelnaos-change, naos-input, naos-highlight-change, naos-invalidToken input with delimiter entry, paste handling, and delete controls.
<naos-file-upload>name, accept, multiple, max-files, disabled, labelnaos-change, naos-invalidFile input with dropzone, picker trigger, list, delete, clear, and FormData support.
<naos-rating-group>name, value, count, disabled, labelnaos-change, naos-hover-changeRating control with pointer and keyboard selection.
<naos-date-picker>name, value, locale, placeholder, disabled, read-only, required, labelnaos-change, naos-focus-change, naos-open-changeSingle-date picker; public value and FormData value use ISO YYYY-MM-DD.
<naos-editable>name, value, placeholder, max-length, submit-mode, disabled, read-only, required, labelnaos-change, naos-edit-change, naos-submit, naos-cancelInline editable text with preview/edit modes and form integration.

Collections

ElementSubcomponentsEventsNotes
<naos-tabs><naos-tab>, <naos-tab-panel>naos-changeZag-backed tab collection with roving focus and selected panel mapping.
<naos-radio-group><naos-radio>naos-changeForm-associated radio collection with roving focus.
<naos-segmented-control><naos-segmented-item>naos-changeSingle-selection segmented control.
<naos-toggle-group><naos-toggle-item>naos-changeSingle or multiple toggle collection.
<naos-select><naos-select-item>naos-change, naos-open-changeSingle-selection popup with typeahead and form integration.
<naos-combobox><naos-combobox-item>naos-change, naos-input, naos-open-changeAutocomplete combobox with popup items and form integration.
<naos-listbox><naos-listbox-item>naos-change, naos-highlight-changeSelection listbox with typeahead, disabled items, and form integration.

Overlays And Disclosure

ElementSubcomponentsEventsNotes
<naos-menu><naos-menu-item>naos-select, naos-open-changeFlat action menu with dismiss behavior and focus return.
<naos-context-menu><naos-menu-item>naos-select, naos-open-changeContext-triggered menu region.
<naos-dialog>Nonenaos-open-changeModal dialog with backdrop, focus trap, scroll lock, dismiss, and focus return.
<naos-popover>Nonenaos-open-changePositioned popover with Escape/outside dismiss and close trigger.
<naos-tooltip>Nonenaos-open-changeHover/focus tooltip with Escape close.
<naos-hover-card>Nonenaos-open-changeHover/focus preview card with positioned content.
<naos-accordion><naos-accordion-item>naos-changeAccordion collection with roving trigger focus and disabled item handling.
<naos-collapsible>Nonenaos-open-changeDisclosure primitive with trigger/content ARIA.

Feedback

ElementKey attributesEventsNotes
<naos-progress>value, min, max, indeterminate, orientation, label, localenaos-changeARIA progressbar with part="track range value" and CSS custom properties.
<naos-avatar>src, alt, fallbacknaos-status-changeImage loading state with fallback content.
<naos-toast>title, description, type, duration, closable, labelnaos-createDeclarative trigger that creates a toast in the package toast store.
<naos-toast-root>label, placementnaos-status-changeMinimal notification region that renders store toasts and owns their lifecycle cleanup.

Each component exposes stable part names, data-* state attributes, and --naos-* CSS custom properties for styling. Declarative Shadow DOM output is covered by the package demo build, but the components are not marked stable until broader validation and documentation coverage are complete.

@naos-ui/compiler

type TransformResult = {
  code: string
  hasChanged: boolean
  map?: unknown
}

transformComponent() returns transformed code, optional source map data, and a change flag. Compiler failures throw structured errors with diagnostics[].

@naos-ui/vite

naos(options) installs the Vite transform and emits prerender metadata by default for DSD workflows. Set prerender: false to disable metadata emission. Vite owns module graph, chunks, CSS imports, assets, and invalidation.

@naos-ui/cli

The naos binary exposes:

CommandPurpose
naos compileTransform a .wc.tsx component.
naos prerenderEmit explicit Declarative Shadow DOM host HTML.
naos infoPrint compiler, package, native target, and platform details.