Radio Group

Pick one option from a list.

Shadcn UI

This component is part of Shadcn UI.

Usage

import { z } from 'zod';
import { AutoForm } from 'vitnode/components/form/auto-form';
import { AutoFormRadioGroup } from 'vitnode/components/form/fields/radio-group';
const formSchema = z.object({
  options: z.enum(['option1', 'option2', 'option3']),
});
<AutoForm
  formSchema={formSchema}
  fields={[
    {
      id: 'options',
      component: props => (
        <AutoFormRadioGroup
          description="By checking this box, you agree to the terms and conditions."
          label="I agree to the terms and conditions"
          labels={[
            {
              value: 'option1',
              label: 'Option 1',
            },
            {
              value: 'option2',
              label: 'Option 2',
            },
            {
              value: 'option3',
              label: 'Option 3',
            },
          ]}
          {...props}
        />
      ),
    },
  ]}
/>

Props

PropTypeDefault
label?
string
-
description?
string
-
labels?
{ value: string; label: string }[]
[]

On this page