Propel

Radio Group Field

A labeled fieldset of radio options with description and helper or error text.

Priority

Pick one default priority.

Recommended.

You can change this later.

Show code
import {
  RadioGroupField,
  RadioGroupFieldOption,
} from "@makeplane/propel/components/radio-group-field";

export default function BasicDemo() {
  return (
    <RadioGroupField
      name="priority"
      label="Priority"
      description="Pick one default priority."
      density="comfortable"
      size="lg"
      defaultValue="medium"
      hint="You can change this later."
    >
      <RadioGroupFieldOption value="low" label="Low" />
      <RadioGroupFieldOption value="medium" label="Medium" description="Recommended." />
      <RadioGroupFieldOption value="high" label="High" />
    </RadioGroupField>
  );
}

Installation

import {
  RadioGroupField,
  RadioGroupFieldOption,
} from "@makeplane/propel/components/radio-group-field";

Usage

import {
  RadioGroupField,
  RadioGroupFieldOption,
} from "@makeplane/propel/components/radio-group-field";

export default function BasicDemo() {
  return (
    <RadioGroupField
      name="priority"
      label="Priority"
      description="Pick one default priority."
      density="comfortable"
      size="lg"
      defaultValue="medium"
      hint="You can change this later."
    >
      <RadioGroupFieldOption value="low" label="Low" />
      <RadioGroupFieldOption value="medium" label="Medium" description="Recommended." />
      <RadioGroupFieldOption value="high" label="High" />
    </RadioGroupField>
  );
}

Examples

Sizes

Legend, description, and option text scale together across lg, xl, and 2xl.

lg

Pick one default priority.

Recommended.

xl

Pick one default priority.

Recommended.

2xl

Pick one default priority.

Recommended.

Show code
import {
  RadioGroupField,
  RadioGroupFieldOption,
} from "@makeplane/propel/components/radio-group-field";

export default function SizesDemo() {
  return (
    <div className="flex flex-wrap items-start gap-10">
      {(["lg", "xl", "2xl"] as const).map((size) => (
        <RadioGroupField
          key={size}
          name={`priority-${size}`}
          label={size}
          description="Pick one default priority."
          density="comfortable"
          size={size}
          defaultValue="medium"
        >
          <RadioGroupFieldOption value="low" label="Low" />
          <RadioGroupFieldOption value="medium" label="Medium" description="Recommended." />
          <RadioGroupFieldOption value="high" label="High" />
        </RadioGroupField>
      ))}
    </div>
  );
}

Densities

density sets the row spacing between options: comfortable keeps a gap, compact stacks them flush.

comfortable

Pick one default priority.

Recommended.

compact

Pick one default priority.

Recommended.

Show code
import {
  RadioGroupField,
  RadioGroupFieldOption,
} from "@makeplane/propel/components/radio-group-field";

export default function DensitiesDemo() {
  return (
    <div className="flex flex-wrap items-start gap-10">
      {(["comfortable", "compact"] as const).map((density) => (
        <RadioGroupField
          key={density}
          name={`priority-${density}`}
          label={density}
          description="Pick one default priority."
          density={density}
          size="lg"
          defaultValue="medium"
        >
          <RadioGroupFieldOption value="low" label="Low" />
          <RadioGroupFieldOption value="medium" label="Medium" description="Recommended." />
          <RadioGroupFieldOption value="high" label="High" />
        </RadioGroupField>
      ))}
    </div>
  );
}

Error

Setting error marks the fieldset invalid and replaces the helper text with the error message. Every option in the group picks up the invalid state, but only the still-unanswered ones recolor to danger — an option the user already picked keeps its normal accent color rather than also reading as wrong.

Project visibility

Controls who can find and open this project.

Only invited members.

Everyone in the workspace.

Anyone with the link.

Select a visibility before creating the project.
Show code
import {
  RadioGroupField,
  RadioGroupFieldOption,
} from "@makeplane/propel/components/radio-group-field";

export default function ErrorDemo() {
  return (
    <RadioGroupField
      name="visibility"
      label="Project visibility"
      description="Controls who can find and open this project."
      density="comfortable"
      size="lg"
      error="Select a visibility before creating the project."
    >
      <RadioGroupFieldOption value="private" label="Private" description="Only invited members." />
      <RadioGroupFieldOption
        value="workspace"
        label="Workspace"
        description="Everyone in the workspace."
      />
      <RadioGroupFieldOption value="public" label="Public" description="Anyone with the link." />
    </RadioGroupField>
  );
}

Controlled

Priority

Pick one default priority.

Recommended.

Selected: medium

Show code
import {
  RadioGroupField,
  RadioGroupFieldOption,
} from "@makeplane/propel/components/radio-group-field";
import * as React from "react";

export default function ControlledDemo() {
  const [value, setValue] = React.useState("medium");

  return (
    <RadioGroupField
      name="priority"
      label="Priority"
      description="Pick one default priority."
      density="comfortable"
      size="lg"
      value={value}
      onValueChange={(next) => setValue(next as string)}
      hint={`Selected: ${value}`}
    >
      <RadioGroupFieldOption value="low" label="Low" />
      <RadioGroupFieldOption value="medium" label="Medium" description="Recommended." />
      <RadioGroupFieldOption value="high" label="High" />
    </RadioGroupField>
  );
}

API Reference

RadioGroupField

Ready-to-use radio group field with legend, description, and helper/error text.

PropTypeDefaultDescription
children(required)ReactNodeRadio option rows, usually `RadioGroupFieldOption`.
density(required)"comfortable" | "compact"Spacing between radio options.
label(required)stringVisible fieldset legend.
size(required)"lg" | "xl" | "2xl"Legend and helper text size.
name(required)stringSubmitted field name.
renderReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, RadioGroupState>Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render.
descriptionReactNodeSupporting text shown below the legend.
errorReactNodeError text shown below the group.
hintReactNodeHelper text shown below the group. Replaced by `error` when an error is set.

RadioGroupFieldOption

A radio option row for use inside `RadioGroupField` or a custom `RadioGroup`.

PropTypeDefaultDescription
label(required)stringVisible option label.
renderReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, RadioRootState>Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render.
descriptionReactNodeOptional supporting text announced as the radio description.
size"lg" | "xl" | "2xl"Label and description size. Inherited from `RadioGroupField` when omitted.