UNPKG

@mitcsutt/kiln-forms

Version:

Kiln forms: typed React forms on TanStack Form, in component or JSON schema mode, rendered through kiln-ui

40 lines (39 loc) • 1.51 kB
import { type ReactNode } from 'react'; import { type Responsive, type Space } from '@mitcsutt/kiln-ui'; import type { HeadingLevel } from '../internal/types.js'; export interface FormSectionProps { title: ReactNode; description?: ReactNode; /** Keeps the title for assistive tech but hides it visually. */ titleHidden?: boolean; /** `fieldset` (default): a group of related fields. `section`: a headed chapter. */ as?: 'fieldset' | 'section'; /** Heading level for `as="section"`. Default 3. */ headingLevel?: HeadingLevel; /** Disables every field inside (native fieldset cascade + presentation). */ disabled?: boolean; /** Makes every field inside read-only (presentation cascade). */ readOnly?: boolean; /** Default `5`. */ gap?: Responsive<Space>; children: ReactNode; } /** * A titled group of fields, as a fieldset and legend, that can be disabled or made read-only as * one. * * @remarks * `FormSection` groups fields under a title. By default it's a `<fieldset>` with the title as its * `<legend>`, so screen readers announce the group with each field. `as="section"` makes it a * `<section>` with a heading instead, for a chapter of a long form. * * @example In a schema * ```json * { * "layout": "section", * "title": "Contact details", * "children": [{ "kind": "text", "name": "name", "label": "Full name" }] * } * ``` */ export declare function FormSection(props: FormSectionProps): import("react").JSX.Element;