@mitcsutt/kiln-forms
Version:
Kiln forms: typed React forms on TanStack Form, in component or JSON schema mode, rendered through kiln-ui
18 lines (17 loc) • 959 B
TypeScript
import { type ReactNode } from 'react';
import { type AnyFieldApi, type AnyFormApi } from '@tanstack/react-form';
/**
* View mode without a TanStack field (§9.11): no `FieldApi` is created or mounted for the path, so a
* read-only copy (a review step) never touches the real field's instance, validators or meta. The
* field component gets a read-only field context whose `value` comes from a selector over this one
* path (re-renders only when that value changes).
*/
export interface ViewFieldProps {
form: AnyFormApi;
name: string;
/** Extra members on the field object (the kit's field components, for the canonical path). */
extend?: Record<string, unknown>;
/** Content, or a render function receiving the read-only field (`AppField` children). */
children: ReactNode | ((field: AnyFieldApi) => ReactNode);
}
export declare function ViewField({ form, name, extend, children }: ViewFieldProps): import("react").JSX.Element;