Skip to main content

Common Examples

import { Radio } from "@servicetitan/anvil2";

function ExampleComponent() {
  return (
    <Radio.Group Group legend="Preferred method of communication">
      <Radio name="comm" label="Email" defaultChecked />
      <Radio name="comm" label="Phone" />
      <Radio name="comm" label="Text" />
    </Radio.Group>
  );
}

Basic radio input

The Radio component accepts many of the same props as an HTML input with type="radio", such as name, value, checked, and defaultChecked.

Controlling radio state

Use the checked and onClick props to manually control the state of a radio.

Using radio groups

The Radio.Group component acts as a wrapper around a collection of Radio components.

React Accessibility

  • The Radio component’s label prop allows for any ReactElement to be passed in, but the label should always be populated with some text content that is screen-reader accessible.
For more guidance on form field labels and context, see input field context association best practices.
Last modified on January 23, 2026