Halo Toggle Group

HaloToggleGroup is a single-select segmented control with a frosted track, a gradient rim, and a spring-animated sliding thumb that matches the layout spring of Halo Button. It is built on Base UI's ToggleGroup and Toggle primitives.

Halo Toggle Group
LIVE · running in a sandboxed iframe
Installed with plain shadcn add · no workarounds · theme neutral (none shipped)
See how it was built

Installation

pnpm dlx shadcn@latest add @cult-ui/halo-toggle-group

Requires @cult-ui in the registries of your components.json (shadcn adds official directory namespaces automatically).

Usage

usage.tsx
import { HaloToggleGroup } from "@/components/ui/halo-toggle-group"export default function Example() {  return (    <HaloToggleGroup      items={[        { value: "day", label: "Day" },        { value: "week", label: "Week" },        { value: "month", label: "Month" },      ]}    />  )}
  • Choosing one option from a small set of mutually exclusive views, such as Day / Week / Month or List / Grid.
  • Filtering or switching a view where a sliding highlight gives clear feedback, and the look should match a Halo Button CTA.
  • Replacing a radio group or tab strip with a compact, glassy segmented control that does not need panels.
  • Use a plain ToggleGroup or RadioGroup instead when you need multi-select, long labels, or a strictly unstyled control.

Examples

Uncontrolled with default selection

Uses defaultValue so the component manages its own selected state. If defaultValue is omitted, the first item is selected.

uncontrolled-with-default-selection.tsx
import { HaloToggleGroup } from "@/components/ui/halo-toggle-group"export function ViewSwitch() {  return (    <HaloToggleGroup      defaultValue="grid"      items={[        { value: "list", label: "List" },        { value: "grid", label: "Grid" },        { value: "board", label: "Board" },      ]}    />  )}

Controlled with onValueChange

Keeps the selected value in React state and reacts to changes through onValueChange.

controlled-with-onvaluechange.tsx
import { useState } from "react"import { HaloToggleGroup } from "@/components/ui/halo-toggle-group"export function RangePicker() {  const [range, setRange] = useState("week")  return (    <HaloToggleGroup      items={[        { value: "day", label: "Day" },        { value: "week", label: "Week" },        { value: "month", label: "Month" },      ]}      onValueChange={setRange}      value={range}    />  )}

Disabled item and opaque track

Disables one item per item flag and turns off the frosted effect with translucent={false}.

disabled-item-and-opaque-track.tsx
import { HaloToggleGroup } from "@/components/ui/halo-toggle-group"export function PlanToggle() {  return (    <HaloToggleGroup      className="w-full"      defaultValue="monthly"      items={[        { value: "monthly", label: "Monthly" },        { value: "yearly", label: "Yearly" },        { value: "lifetime", label: "Lifetime", disabled: true },      ]}      translucent={false}    />  )}

API reference

PropTypeDefaultDescription
itemsHaloToggleGroupItem[]—Segments to render. Each item has value (string, used as the selected key), label (ReactNode), and optional disabled (boolean).
valuestring—Selected value for controlled usage. When it is undefined, the component is uncontrolled.
defaultValuestringitems[0]?.value ?? ""Initial selected value for uncontrolled usage.
onValueChange(next: string) => void—Called with the newly selected value when the user selects a segment.
classNamestring—Extra classes merged onto the outer wrapper element.
translucentbooleantrueEnables the frosted track with backdrop blur and translucent gradient. When false, the track uses a more opaque card-to-muted gradient and the glow is dimmed.
disabledbooleanfalseDisables the whole group. Passed to the underlying ToggleGroup.

Accessibility

  • Built on Base UI ToggleGroup with multiple={false}, so it behaves as a single-select group; each segment is a Toggle that reflects its pressed state through aria-pressed, which the styles use for the selected appearance.
  • Give each item a meaningful, text-based label, because the component exposes no aria-label or group label prop; wrap the component with a labelled container or add an accessible name in your surrounding markup if needed.
  • The sliding thumb and the glow layers are aria-hidden or pointer-events-none, so they do not add noise to assistive technology or intercept clicks.
  • Focus-visible shows a 2px ring with an offset on the focused segment, and keyboard arrow navigation comes from the underlying Base UI primitives.
  • Disabled items receive the disabled state and are dimmed with pointer events turned off.
  • When the user prefers reduced motion, the thumb transition is set to zero duration and the background glow stops repeating, which avoids motion-triggered discomfort.
  • Text contrast relies on muted-foreground versus foreground for the selected segment; verify contrast against your theme, especially with translucent mode over busy backgrounds.

Docs written by anthropic:claude-haiku-5-5 from the registry source.

Use with Coding Agent

Paste this into Claude Code, Codex or Cursor. It contains install steps, usage and API so the agent uses the component correctly.

prompt.md
Use the "Halo Toggle Group" component (cult-ui/halo-toggle-group) from its shadcn registry.1. Install it with: npx shadcn@latest add @cult-ui/halo-toggle-group2. Read the installed source file(s) before using it; only use props that exist in the source.3. Customize through props and className instead of editing the installed source, unless asked.4. Available props: items, value, defaultValue, onValueChange, className, translucent, disabled.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { HaloToggleGroup } from "@/components/ui/halo-toggle-group"export default function Example() {  return (    <HaloToggleGroup      items={[        { value: "day", label: "Day" },        { value: "week", label: "Week" },        { value: "month", label: "Month" },      ]}    />  )}```

Files & dependencies

  • registry/default/ui/halo-toggle-group.tsx
dependencies@base-ui/reactmotion

Looks similar, elsewhere