@mitcsutt/kiln-forms
Version:
Kiln forms: typed React forms on TanStack Form, in component or JSON schema mode, rendered through kiln-ui
42 lines (41 loc) • 1.47 kB
TypeScript
import { type RadioGroupFieldProps as UiRadioGroupFieldProps } from '@mitcsutt/kiln-ui';
import type { ControlledKeys } from '../internal/controlledKeys.js';
import { type CommonFieldProps } from '../../../hooks/useFieldBinding.js';
import { type FieldOption, type Primitive } from '../../../kit/contracts.js';
export interface FormRadioFieldProps extends Omit<UiRadioGroupFieldProps, ControlledKeys | 'options'>, CommonFieldProps<Primitive | null> {
/** Typed to the bound path's own value type in the typed shorthand. */
options?: readonly FieldOption[];
}
/**
* One choice from a short list, as radios under a legend.
*
* @remarks
* It renders kiln-ui's {@link RadioGroupField | RadioGroupField}.
*
* @example In a schema
* ```json
* {
* "kind": "radio",
* "name": "deck",
* "label": "Deck",
* "options": [
* {
* "value": "upper",
* "label": "Upper deck"
* },
* {
* "value": "lower",
* "label": "Lower deck"
* }
* ]
* }
* ```
*
* @value the options' value type, or `null`
* @empty `null`
*
* @privateRemarks
* One choice from a short list, as radios (§7.2 `radio`). Option values keep their primitive
* type (numbers and booleans round-trip through the string-only ui control, §7.3); empty is `null`.
*/
export declare const FormRadioField: import("../../../kit/contracts.js").FieldDef<import("../../../kit/contracts.js").OptionContract<Primitive>, FormRadioFieldProps>;