Skip to content

Switch

Interface

export type ISwitchTypeValue = boolean;
 
export interface ISwitchField extends CommonField {
    type: 'switch';
    options?: {
        trueValue?: string;
        falseValue?: string;
    };
    private?: () => Promise<ISwitchTypeValue>;
    render?: (v: ISwitchTypeValue) => JSX.Element;
    validation?: Validation<ISwitchTypeValue>;
}

Example

{
  type: 'switch',
  name: 'YOUR_PATH',
  options: {
    trueValue: 'Yes',
    falseValue: 'No'
  },
  validation: z.boolean()
}