@mitcsutt/kiln-forms
Version:
Kiln forms: typed React forms on TanStack Form, in component or JSON schema mode, rendered through kiln-ui
39 lines (38 loc) • 1.51 kB
TypeScript
import { type CheckboxGroupFieldProps as UiCheckboxGroupFieldProps } from '@mitcsutt/kiln-ui';
import type { ControlledKeys } from '../internal/controlledKeys.js';
import { type CommonFieldProps } from '../../../hooks/useFieldBinding.js';
import { type FieldOption } from '../../../kit/contracts.js';
/** The base value of a checkbox-group option (§7.2 `checkboxGroup`: no booleans). */
export type CheckboxGroupValue = string | number;
export interface FormCheckboxGroupFieldProps extends Omit<UiCheckboxGroupFieldProps, ControlledKeys | 'options'>, CommonFieldProps<readonly CheckboxGroupValue[]> {
options?: readonly FieldOption<CheckboxGroupValue>[];
}
/**
* Any number of choices from a short list, as checkboxes under a legend.
*
* @remarks
* It renders kiln-ui's {@link CheckboxGroupField | CheckboxGroupField}.
*
* @example In a schema
* ```json
* {
* "kind": "checkboxGroup",
* "name": "facilities",
* "label": "Facilities you need",
* "options": [
* {
* "value": "step-free",
* "label": "Step-free access"
* }
* ]
* }
* ```
*
* @value an array of the options' value type
* @empty `[]`
*
* @privateRemarks
* Any number of choices from a short list, as checkboxes (§7.2 `checkboxGroup`). Option values
* keep their primitive type; empty is `[]`.
*/
export declare const FormCheckboxGroupField: import("../../../kit/contracts.js").FieldDef<import("../../../kit/contracts.js").OptionsContract<CheckboxGroupValue>, FormCheckboxGroupFieldProps>;