s-m-r-t
Open the s-m-r-t source on GitHub Switch to dark color scheme
← All UI components

Forms and controls

Form

Form — the Provider-free base `<form>` primitive. A thin, dependency-free wrapper around the native `<form>` element so domain components have a primitive to adopt instead of hand-rolling raw `<form>` markup (issue #1589). It forwards every native form attribute (including `onsubmit`) and renders its children — no Provider, no i18n, no spoken-input logic. For the rich, Provider-backed form with field registration and voice input, use `Form` from `@happyvertical/smrt-svelte/forms` instead. This one is the leaf-level building block; that one composes app state on top. `preventDefault` (default `true`) calls `event.preventDefault()` before invoking the consumer's `onsubmit`, so a click/Enter submit runs the handler without a full-page navigation — the near-universal SPA pattern. Pass `preventDefault={false}` to keep native submission (e.g. a GET/POST `action`).

Public export

typescript
import { Form } from '@happyvertical/smrt-ui/forms';
Import path
@happyvertical/smrt-ui/forms
Props
7
Props described
7 of 7
Bindable state
0
Callback events
1
Verified release
0.44.0

Props

Also accepts Omit<HTMLFormAttributes, 'class'>. The table lists the component-specific contract.

NameTypeRequiredDescription
classstringNoCSS class to apply to the form element.
preventDefaultbooleanNoWhether to prevent default form submission behavior.
formIdstringNoStable form scope used by voice/chat/tutorial adapters.
interactionRegistryControlInteractionRegistryNoSupply a registry to coordinate multiple forms or inspect commands.
oninteraction(event: ControlInteractionEvent) => voidNoReceives registry lifecycle and command events.
stagedReviewbooleanNoRender the built-in human review surface for staged changes.
childrenSnippetYesForm controls and content inside the form.

Bindable state

This component has no bindable public state.

Callback events

  • oninteraction(event: ControlInteractionEvent) => void

Examples and explanation