Checkbox

Toggle between checked and unchecked states.

Shadcn UI

This component is part of Shadcn UI.

Usage

import { z } from 'zod';
import { AutoForm } from 'vitnode/components/form/auto-form';
import { AutoFormCheckbox } from 'vitnode/components/form/fields/checkbox';
const formSchema = z.object({
  acceptTerms: z.boolean().refine(val => val === true, {
    message: 'You must accept the terms and conditions',
  }),
});
<AutoForm
  formSchema={formSchema}
  fields={[
    {
      id: 'acceptTerms',
      component: props => (
        <AutoFormCheckbox
          label="I accept the terms and conditions"
          {...props}
        />
      ),
    },
  ]}
/>

Props

PropTypeDefault
label?
string
-
description?
string
-

On this page