Oxform
API

createField

Field values, input props, imperative methods, and the Field component.

createField

createField({ form, name }) returns a stable field API with reactive id, value, state, and props. The path and its value type follow the form schema. Options accept an object, reactive getters, or an accessor. Changing form or name rebinds retained methods, subscriptions, and owned refs.

Properties

PropertyContract
options, storeCurrent binding and observable field store.
id, valueReactive field identifier and current value.
stateStable container with reactive id, value, defaultValue, ref, issues, and status getters.
propsStable input props containing a reactive value and retained event handlers.

state.issues contains only this path's grouped issues. issues({ nested: true }) reads descendants imperatively. Read field status through state.status.

Input Props

PropertyContract
valueCurrent value.
ref(element)Registers an HTMLElement; null is a no-op.
onInput(event)Passes event.currentTarget.value to change.
onBlur(event)Calls blur().
onFocus(event)Calls focus().

Spread props directly in JSX for text inputs, textareas, and single-value selects. onInput writes text during typing and triggers configured change validation. Solid's onChange uses native change-event timing.

Checkboxes, numbers, files, and custom controls need explicit conversion. For a checkbox:

import { ,  } from '@oxform/solid';
import {  } from 'zod';

function () {
  const  = ({ : .({ : .() }), : { : false } });
  const  = ({ , : 'enabled' });

  return (
    <>
      <
        ='checkbox'
        ={.}
        ={.}
        ={ => .(..)}
        ={() => .()}
        ={() => .()}
      />
      Receive updates
    </>
  );
}

Methods

MethodContract
get()Current value snapshot.
change(valueOrUpdater, options?)Write a value or updater result. Marks this path and ancestors dirty and touched by default.
focus(options?), blur(options?)Operate on the registered element and update interaction status, also when no element is registered.
register(element), unregister()Register an element or explicitly clear the ref.
issues(options?)Read direct issues, or descendants with { nested: true }.
setIssues(issues, options?)Write level buckets using replace (default), append, or keep.
reset(options?)Restore default value, issues, refs, and default field status for this path and descendants.

Change options should.dirty: false and should.touch: false preserve existing flags. should.validate controls the matching event; by default it runs when configured. Change, focus, and blur return before asynchronous validation finishes. Await form.validate for completion.

Issue mode replace replaces every bucket, including omitted levels. append adds entries. keep preserves all buckets if any existing bucket contains an issue. Later validation follows the event replacement rules.

Field reset accepts a non-nullish value override. The current core API accepts status and keep in its type but does not apply those field reset options. Use form-level preservation when needed.

createFieldApi

createFieldApi(options) provides the same imperative field operations, dynamic binding, and owned ref cleanup. It adds no reactive field state or input props. Observe a selected slice explicitly:

import { , ,  } from '@oxform/solid';
import {  } from 'zod';

function () {
  const  = ({ : .({ : .() }), : { : '' } });
  const  = ({ , : 'email' });
  const  = (,  => .);
  return <>{()}</>;
}

Field

Accepts form, name, and a render function receiving the full createField return value. It adds no DOM wrapper. Dynamic JSX props track changes to the binding.

import { ,  } from '@oxform/solid';
import {  } from 'zod';

function () {
  const  = ({ : .({ : .() }), : { : '' } });
  return (
    < ={} ='email'>
      { => < ='Email' {....} />}
    </>
  );
}

See Lifecycle for cleanup and ref ownership.

Types

Prop

Type

Prop

Type

Prop

Type