VitNode
Forms

Switch

A control that enables the user to toggle between two states, such as on and off.

Shadcn UI

This component is part of Shadcn UI.

Preview

Usage

import { z } from 'zod';
import { AutoForm } from 'vitnode-frontend/form/auto-form';
import { AutoFormSwitch } from 'vitnode-frontend/form/fields/switch';
const formSchema = z.object({
  allow_files: z.boolean(),
});
<AutoForm
  formSchema={formSchema}
  fields={[
    {
      id: 'allow_files',
      component: AutoFormSwitch,
    },
  ]}
/>

API Reference

Radix UI Switch.

On this page