MDK Logo

RadioCard

RadioCard component - button-like radio option Supports an `onChange` callback when selected.

RadioCard component - button-like radio option

Supports an onChange callback when selected.

import { RadioCard } from "@tetherto/mdk-react-devkit";
PropStatusTypeDefaultDescription
sizeOptionalComponentSize | undefined'md'Size variant of the radio
colorOptional"success" | "warning" | "error" | "primary" | "default" | undefined'default'Color variant when checked
radiusOptionalBorderRadius | undefined'full'Border radius variant (full makes it circular)
classNameOptionalstring | undefinedCustom className for the root element
labelOptionalstring | undefinedLabel text (or use children for custom content)
childrenOptionalReact.ReactNodeChildren content (takes precedence over label)
indicatorClassNameOptionalstring | undefinedCustom className for the indicator element

Usage

Accessible radio buttons built on Radix UI @radix-ui/react-radio-group. Provides three components: Radio (individual item), RadioGroup (container), and RadioCard (button-style radio).

RadioGroup Props

PropTypeRequiredDefaultDescription
orientation'horizontal' | 'vertical'no'vertical'Layout direction
noGapbooleannofalseRemoves the default gap between radio items
classNamestringnoAdditional class

All Radix RadioGroupPrimitive.Root props (e.g. defaultValue, value, onValueChange, disabled) are also accepted.

Radio Props

PropTypeRequiredDefaultDescription
valuestringyesValue associated with this option
sizeComponentSize ('sm' | 'md' | 'lg')no'md'Size variant
colorComponentColorno'primary'Color variant when checked
radiusBorderRadiusno'full'Border radius ('full' for circle)
labelstringnoText label rendered inside the item
childrenReact.ReactNodenoCustom content (takes precedence over label)
indicatorClassNamestringnoAdditional class for the inner indicator dot

All Radix RadioGroupPrimitive.Item props are also accepted.

RadioCard Props

Accepts the same props as Radio. Renders as a button-styled card suitable for time-range selectors.

Default overrides: size='sm', color='default', radius='none'.

Example

/** * Runnable example for Radio and RadioGroup. */import { useState } from 'react'import { Radio, RadioCard, RadioGroup } from '@tetherto/mdk-react-devkit'export const RadioExample = () => {  const [plan, setPlan] = useState('standard')  const [interval, setInterval] = useState('5min')  return (    <div className="mdk-example-col">      <RadioGroup value={plan} onValueChange={setPlan} orientation="vertical">        <div className="mdk-example-inline">          <Radio value="basic" color="primary" />          <span>Basic</span>        </div>        <div className="mdk-example-inline">          <Radio value="standard" color="primary" />          <span>Standard</span>        </div>        <div className="mdk-example-inline">          <Radio value="pro" color="primary" disabled />          <span>Pro (unavailable)</span>        </div>      </RadioGroup>      <RadioGroup value={interval} onValueChange={setInterval} orientation="horizontal">        <RadioCard value="5min" label="5 Min" />        <RadioCard value="15min" label="15 Min" />        <RadioCard value="30min" label="30 Min" />        <RadioCard value="1h" label="1 Hour" />      </RadioGroup>    </div>  )}