Radio Group
A set of round options where exactly one is selected.
Preview
Billing for Tomás’s team
Courier pickup, Thu 14 Nov
Pick a window so Malik can book the courier.
Install
Add the editable source with the shadcn CLI. Your project also needs the shared theme tokens this component uses. Setup and requirements. The Pebble installer is not published yet.
npx shadcn@latest add https://pebbleui.com/r/radio-group.jsonProps
| Prop | Type | Default | Description |
|---|---|---|---|
| value | string | — | Controlled selection (RadioGroup) |
| defaultValue | string | — | Uncontrolled selection (RadioGroup) |
| onValueChange | (value: string) => void | — | Called when selection changes (RadioGroup) |
| orientation | "horizontal" | "vertical" | — | Restricts arrow keys to one axis (RadioGroup) |
| disabled | boolean | false | On RadioGroup or a single RadioGroupItem |
| value (item) | string | — | Required on each RadioGroupItem |
Build notes
Radix RadioGroup primitive supplies roving tabindex, arrow-key handling and
the hidden form input. The item is an inline grid centring the Indicator,
which Radix mounts only when selected; the dot is a plain `rounded-full` span
in `bg-primary-foreground` (no icon). Off outline / on fill matches Switch and
Checkbox so the form set reads consistently. Forced colors: edge
`CanvasText`, selected item `Highlight` (forced with `!`), dot `HighlightText`.
**Pebble (2026-11-03).** Items share the checkbox recipe: recessed card well with a full-strength `border-control` edge, lit key when checked, key-press and scale on press, 2 px ring with offset on focus. The indicator is a `data-slot="radio-group-dot"` paper dot that springs in (`{stiffness:420,damping:32,mass:0.8}`) only after the group's `onValueChange` has fired once (a `touched` context in the root), so first paint is static and hydration-safe; reduced motion shows it without scale. Forced colours map the dot to `HighlightText`.
<!-- PEBBLE-LICENSE -->View source
registry/input/radio-group/radio-group.tsx
"use client";
/* PEBBLE-LICENSE
Built by Pebble. Component: radio-group.
First-party license: MIT
The following first-party terms apply only to original Pebble material.
MIT License
Copyright (c) 2026 Praxys Solutions LLC (Pebble)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
THIRD-PARTY NOTICES
These notices apply to identified upstream portions; Pebble terms do not replace or narrow their rights.
Upstream: https://raw.githubusercontent.com/shadcn-ui/ui/main/LICENSE.md
MIT License
Copyright (c) 2023 shadcn
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
END PEBBLE-LICENSE */
import * as React from "react";
import { RadioGroup as RadioGroupPrimitive } from "radix-ui";
import { motion, useReducedMotion } from "motion/react";
import { cn } from "@/lib/utils";
// True once the group's value has changed in this session, so the dot only
// springs in on a real selection. First render (and SSR) shows it settled.
const TouchedContext = React.createContext(false);
export type RadioGroupProps = React.ComponentProps<typeof RadioGroupPrimitive.Root>;
export function RadioGroup({ className, onValueChange, ...props }: RadioGroupProps) {
const [touched, setTouched] = React.useState(false);
return (
<TouchedContext.Provider value={touched}>
<RadioGroupPrimitive.Root
data-slot="radio-group"
onValueChange={(value) => {
setTouched(true);
onValueChange?.(value);
}}
className={cn("grid gap-3", className)}
{...props}
/>
</TouchedContext.Provider>
);
}
export type RadioGroupItemProps = React.ComponentProps<typeof RadioGroupPrimitive.Item>;
export function RadioGroupItem({ className, ...props }: RadioGroupItemProps) {
const touched = React.useContext(TouchedContext);
const reduce = useReducedMotion();
const animate = touched && !reduce;
return (
<RadioGroupPrimitive.Item
data-slot="radio-group-item"
className={cn(
"peer relative inline-grid aspect-square size-4 shrink-0 cursor-pointer place-content-center rounded-full border",
"transition-[background-color,border-color,box-shadow,transform,filter] duration-(--motion-fast) ease-enter motion-reduce:transition-none",
// Unselected is a recessed well with the control edge at full
// strength; selected is the lit key with a paper dot.
"border-border-control bg-card inset-shadow-xs enabled:hover:border-muted-foreground enabled:hover:bg-muted",
"data-[state=checked]:border-key-edge data-[state=checked]:bg-linear-to-b data-[state=checked]:from-key-top data-[state=checked]:to-key-bottom data-[state=checked]:shadow-[var(--key-shine),var(--elevation-xs)] data-[state=checked]:inset-shadow-none",
"enabled:data-[state=checked]:hover:border-key-edge enabled:data-[state=checked]:hover:brightness-110",
"enabled:active:scale-[0.92] enabled:data-[state=checked]:active:shadow-[var(--key-press)] motion-reduce:enabled:active:scale-100",
"outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
"aria-invalid:border-danger aria-invalid:ring-[3px] aria-invalid:ring-danger/20",
"disabled:cursor-not-allowed disabled:opacity-50",
"forced-colors:border-[CanvasText] forced-colors:data-[state=checked]:border-[Highlight] forced-colors:data-[state=checked]:bg-[Highlight]!",
className,
)}
{...props}
>
<RadioGroupPrimitive.Indicator
data-slot="radio-group-indicator"
className="grid place-content-center"
>
<motion.span
data-slot="radio-group-dot"
className="block size-1.5 rounded-full bg-primary-foreground forced-colors:bg-[HighlightText]!"
initial={animate ? { scale: 0, opacity: 0 } : false}
animate={{ scale: 1, opacity: 1 }}
transition={{ type: "spring", stiffness: 420, damping: 32, mass: 0.8 }}
/>
</RadioGroupPrimitive.Indicator>
</RadioGroupPrimitive.Item>
);
}
