Skip to content

Checkbox

Interface

export type ICheckboxTypeValue = string[];
 
export interface ICheckboxField extends CommonField {
    type: 'checkbox';
    options: {
        items: {
            label: string;
            value: string;
            disabled?: boolean;
        }[];
    };
    private?: () => Promise<ICheckboxTypeValue>;
    render?: (v: ICheckboxTypeValue) => JSX.Element;
    validation?: Validation<ICheckboxTypeValue>;
}

Example

 {
  type: 'checkbox',
  name: 'YOUR_PATH',
  options: {
    items: [
      { value: 'javascript', label: 'JavaScript' },
      { value: 'typescript', label: 'TypeScript' },
      { value: 'python', label: 'Python' }
    ]
  },
  validation: z.array(z.enum(['javascript', 'typescript', 'python']))
}