Xzero UI
Pro library

Glass segmentedPro

A glass segmented control whose liquid indicator stretches between segments and can be dragged and flung.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui-pro/glass-segmented
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-pro/glass-segmented

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 { useState } from "react";
import { GlassSegmented } from "@/components/xzero/glass-segmented/glass-segmented";

export function MapMode() {
  const [mode, setMode] = useState("explore");
  return (
    <GlassSegmented
      label="Map mode"
      value={mode}
      onValueChange={setMode}
      options={[
        { value: "explore", label: "Explore" },
        { value: "drive", label: "Drive" },
        { value: "transit", label: "Transit" },
      ]}
    />
  );
}

API reference

GlassSegmented

A glass segmented control with a liquid indicator: the leading edge races ahead and the trailing edge catches up, so the drop stretches and thins between segments. Drag the selected segment to slide it.

PropTypeDefaultDescription
options (required)GlassSegmentedOption[]–Segments: { value, label, icon?, badge?, disabled? }. badge shows a small count in the accent color.
label (required)string–Accessible name of the group.
valuestring–Controlled value.
defaultValuestring–Initial value when uncontrolled. Defaults to the first enabled option.
onValueChange(value: string) => void–Called when a segment is chosen by click, keys, or a drag.
size"sm" | "md""md"36px or 44px tall.
fullWidthbooleanfalseStretches to the container width with equal segments.
classNamestring–Extra class on the root.
styleCSSProperties–Inline styles on the root.

Keyboard interactions

KeysAction
TabFocus the selected segment.
Arrow keysSelect the previous or next segment, wrapping at the ends.
Home / EndSelect the first or last segment.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Also in glass

Guidance for AI tools

Glass segmented: A glass segmented control whose liquid indicator stretches between segments and can be dragged and flung. 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