Skip to content

Toggle Group

Interface

export type IToggleGroupTypeValue = string[];
 
export interface IToggleGroupField extends CommonField {
    type: 'toggle-group';
    options: {
        items: string[] | {
            label: string;
            value: string;
            disabled?: boolean;
        }[];
    };
    private?: () => Promise<IToggleGroupTypeValue>;
    render?: (v: IToggleGroupTypeValue) => JSX.Element;
    validation?: Validation<IToggleGroupTypeValue>;
}

Example

Toggle Group with List of String

{
  type: 'toggle-group',
  name: 'YOUR_PATH',
  options: {
    items: ['React', 'Vue', 'Svelte']
  }
}

Toggle Group with List of Object

{
  type: 'toggle-group',
  name: 'YOUR_PATH',
  options: {
    items: [
      { label: 'React', value: 'react' },
      { label: 'Vue', value: 'vue' },
      { label: 'Svelte', value: 'svelte' }
    ]
  }
}