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/core/components/form/auto-form';
import { AutoFormCheckbox } from '@vitnode/core/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}
/>
),
},
]}
/>
import { Checkbox } from '@vitnode/core-frontend/components/ui/checkbox';
<Checkbox onChange={onChange} checked={checked} />
Props
Prop | Type | Default |
---|---|---|
description? | string | - |
label? | string | - |