Xzero UI
Pro library

Radio cards

Selectable option cards with a sliding selection ring, price and description slots, and radio keyboard behavior.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui/radio-cards
Live · keyboard ready

When to use

When not to use

Installation

Register both Xzero UI namespaces in your project's components.json:

{
  "registries": {
    "@xzero-ui": "https://mcp.xzero.co.uk/r/{name}.json",
    "@xzero-ui-pro": "https://mcp.xzero.co.uk/r/pro/{name}.json"
  }
}
npx shadcn@4.23.0 add @xzero-ui/radio-cards

Install xzero-foundation once, and import @/components/xzero/foundation.css in your app root. No Xzero token is used by this snapshot. For sample portraits, photos, fonts, or logos, download https://mcp.xzero.co.uk/install-assets.mjs and run node xzero-install-assets.mjs <receiving-project>.

Usage

import { RadioCards } from "@/components/xzero/radio-cards/radio-cards";

export function ShippingSpeed() {
  return (
    <RadioCards
      aria-label="Shipping speed"
      name="shipping"
      layout="list"
      defaultValue="standard"
      options={[
        { value: "standard", label: "Standard", description: "4 to 6 business days", meta: "Free" },
        { value: "express", label: "Express", description: "2 business days", meta: "$12" },
        { value: "overnight", label: "Overnight", meta: "$29", disabled: true, disabledReason: "Not available for this address" },
      ]}
    />
  );
}

API reference

RadioCards

Selectable option cards for choices that need more than a label. One selection ring glides from card to card, and the group behaves as a native radio group.

PropTypeDefaultDescription
options (required)RadioCardOption[]–Choices: { value, label, description?, meta?, icon?, disabled?, disabledReason? }.
valuestring | null–Selected value (controlled).
defaultValuestring | nullnullInitial value when uncontrolled.
onValueChange(value: string) => void–Called when a new card is selected.
layout"grid" | "list""grid""grid" places cards in responsive columns; "list" stacks full-width rows with meta at the end.
minColumnWidthnumber180Narrowest a grid column may get before the grid drops a column, in px.
namestring–Form field name. Renders a hidden input with the selected value.
requiredboolean–Marks the group and hidden input as required.
disabledbooleanfalseDisables every card.
...propsHTMLAttributes<HTMLDivElement>–Forwarded to the radiogroup, including ref, aria-label, and className.

Keyboard interactions

KeysAction
TabFocuses the selected card, or the first enabled one. One tab stop for the group.
Arrow keysMove to the next or previous enabled card and select it, wrapping. Left and right flip in RTL.
Home / EndSelect the first or last enabled card.
Enter / SpaceSelects the focused card.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Also in toggles

Guidance for AI tools

Radio cards: Selectable option cards with a sliding selection ring, price and description slots, and radio keyboard behavior. Follow the declared prop types and do not invent props. Keep keyboard access, reduced motion support, and both light and dark themes intact when adapting it.

Full library index: https://ui.xzero.co.uk/llms.txt

Browse all components