Propel

Radio Group Field

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

Basic

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"
      magnitude="md"
      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>
  );
}

Magnitudes

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

md

Pick one default priority.

Recommended.

lg

Pick one default priority.

Recommended.

xl

Pick one default priority.

Recommended.

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

export default function MagnitudesDemo() {
  return (
    <div className="flex flex-wrap items-start gap-10">
      {(["md", "lg", "xl"] as const).map((magnitude) => (
        <RadioGroupField
          key={magnitude}
          name={`priority-${magnitude}`}
          label={magnitude}
          description="Pick one default priority."
          density="comfortable"
          magnitude={magnitude}
          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}
          magnitude="md"
          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.

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"
      magnitude="md"
      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"
      magnitude="md"
      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>
  );
}

Installation

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

Props

RadioGroupField

PropTypeRequiredDescription
renderReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, RadioGroupState>NoAllows 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.
childrenReactNodeYesRadio option rows, usually `RadioGroupFieldOption`.
density"comfortable" | "compact"YesSpacing between radio options.
descriptionReactNodeNoSupporting text shown below the legend.
errorReactNodeNoError text shown below the group.
hintReactNodeNoHelper text shown below the group. Replaced by `error` when an error is set.
labelstringYesVisible fieldset legend.
magnitude"md" | "lg" | "xl"YesLegend and helper text size.
namestringYesSubmitted field name.

RadioGroupFieldOption

PropTypeRequiredDescription
renderReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, RadioRootState>NoAllows 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.
labelstringYesVisible option label.
descriptionReactNodeNoOptional supporting text announced as the radio description.
magnitude"md" | "lg" | "xl"NoLabel and description size. Inherited from `RadioGroupField` when omitted.