@mitcsutt/kiln-forms
Version:
Kiln forms: typed React forms on TanStack Form, in component or JSON schema mode, rendered through kiln-ui
29 lines (28 loc) • 1.51 kB
TypeScript
import { type ReactNode } from 'react';
import { type DataListProps } from '@mitcsutt/kiln-ui';
export interface FieldViewProps {
label: ReactNode;
/** The display value; `null`/`undefined`/`''` render `messages.notProvided`. */
children?: ReactNode;
}
/**
* A `DataList` whose direct children are view-mode fields: they render bare `DataList.Item`s into
* it, so a run of fields reads as one list. Put only fields in it: a layout inside resets the
* context (`FieldViewListBoundary`), so its fields render their own lists — but the layout's own
* markup would still sit inside the `<dl>`.
*/
export declare function FieldViewList({ children, ...props }: DataListProps): import("react").JSX.Element;
/**
* A layout boundary: fields below it are no longer *directly* inside a `FieldViewList`, so they
* render self-contained lists again. Every forms layout renders one around its content.
*/
export declare function FieldViewListBoundary({ children }: {
children: ReactNode;
}): import("react").JSX.Element;
/**
* A field's view-mode rendering (FormReview, `Form mode="view"`): a self-contained one-item
* `DataList` (`dl` → `dt`/`dd`), or a bare `DataList.Item` when directly inside a `FieldViewList`.
* Valid list markup wherever it is placed. No control, no validation UI. With `viewLines` in the
* presentation (`Form`, `FormReview`), the value is clamped in a `ShowMore`.
*/
export declare function FieldView({ label, children }: FieldViewProps): import("react").JSX.Element;