smrt
Open the smrt source on GitHub Switch to dark color scheme
← All UI components

Fields · Components

PolicyField

Layout-neutral wrapper around any input.

Public export

typescript
import { PolicyField } from '@happyvertical/smrt-fields/svelte';
Import path
@happyvertical/smrt-fields/svelte
Props
10
Props described
10 of 10
Bindable state
0
Callback events
0
Verified release
0.62.10

Props

NameTypeRequiredDescription
namestringYesThe field name matching a key in the resolved policy's `fields`.
idstringNoStable per-form control id; defaults to `name` for standalone use.
helpIdstringNoStable per-form help id; defaults to `${id}-help`.
childrenSnippetNoChildren — the actual input(s). Always rendered when the field is visible (unless the `render` snippet escape hatch is used).
renderSnippet<[PolicyFieldSnippetProps]>NoHeadless escape hatch: a snippet receiving all resolved policy data for fully custom rendering. When provided, it replaces the default label + children + help layout entirely.
isNewRecordbooleanNoWhether this is a new record. When true (default) and the field has a resolved default, the provider can prefill. Set to false for loaded records to prevent overwriting existing values.
labelstringNoOverride the resolved label. When provided, takes precedence over the policy label.
helpstringNoOverride the resolved help text. When provided, takes precedence over the policy help.
helpDensity'hint' | 'tooltip'NoDensity of the help hint: 'hint' (inline hint text, default) or 'tooltip' (title attribute on the label).
classstringNoAdditional class for the wrapper element.

Bindable state

This component has no bindable public state.

Callback events

This component declares no callback event props.

Examples and explanation