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

Fields · Components

FieldPolicyProvider

FieldPolicyProvider — the form-level entry point for policy-driven forms. Receives a resolved {@link ResolvedObjectFieldPolicy} **as props** (SSR `initialData` or a client fetch by the app). Owns mode state (`basic`/ `advanced`) and publishes the reactive context consumed by `PolicyField`, `ModeSwitch`, `AdvancedFields`, and `FormHelp`. No `smrt-web` import in the core primitive — an optional `./web` adapter can wire live invalidation for apps that want it; this component is policy-source agnostic. SSR seeding: props seed `$state` via `untrack()` so the first render reflects the request, with a client-only `$effect` resync — the same pattern as ThemeProvider (`smrt-ui/src/themes/ThemeProvider.svelte:53-70`).

Public export

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

Props

NameTypeRequiredDescription
policyResolvedObjectFieldPolicyYesPre-resolved field policy for the object. Pass the output of `resolveFieldPolicy()` (server-side) or the `resolveBatch` endpoint response (client-side).
modeFieldPolicyModeNoInitial display mode — 'basic' hides advanced-tier fields.
childrenSnippetNoChildren rendered inside the provider.

Bindable state

This component has no bindable public state.

Callback events

This component declares no callback event props.

Examples and explanation