Forms

SegmentedControl.

A compact way to choose a view.

Live preview

Live preview
tsx
import { SegmentedControl } from "luminescent";
import "luminescent/style.css";


export function Example() {
  return (
    <SegmentedControl
      tabs={["Design", "Develop", "Deploy"]}
      defaultActiveTab="Design"
      aria-label="Workflow"
    />
  );
}

Installation

bash
npm install luminescent

Import luminescent/style.css once at your application root. The example above uses the same package implementation as Storybook.

Variants and states

Use the preview controls to explore the supported variants, sizes, disabled/loading states and reduced motion. Controls appear only where the component exposes the corresponding prop. Theme and glow apply to every component.

Controlled and uncontrolled state

State contract: value (or activeTab) / defaultActiveTab / onChange. Omit the controlled prop to let the component own its initial state; supply a value and callback when your application owns it. Native uncontrolled fields and state-backed form controls participate in form reset. Controlled state must be reset by the application.

tsx
import { useState } from "react";
import { SegmentedControl } from "luminescent";


export function ControlledExample() {
  const [value, setValue] = useState("Design");
  return (
    <SegmentedControl
      aria-label="Workflow"
      tabs={["Design", "Develop", "Deploy"]}
      value={value}
      onChange={setValue}
    />
  );
}

API reference

Generated from the source TypeScript interfaces. Native attributes, className, style, aria-* and data-* also pass through to the documented element. Import SegmentedControlProps from the package for the full inherited contract.

PropTypeDetails
tabsrequiredstring[]Legacy name for selection options, unrelated to tab panels.
defaultActiveTabstringOptional unless marked required.
activeTabstringOptional unless marked required.

Accessibility and keyboard

A native radio selection group with arrow keys. Legacy tabs is the options prop name; it does not describe tab panels. Use Tabs when choices reveal associated panels.

Keep labels meaningful and test application-level contrast, focus order and screen-reader output. See the accessibility guide for composition requirements.

Theme customization

tsx
import { LuminescentProvider, SegmentedControl } from "luminescent";
import "luminescent/style.css";


export function Example() {
  return (
    <LuminescentProvider theme="light" accent="violet" glow="subtle">
      <SegmentedControl
        tabs={["Design", "Develop", "Deploy"]}
        defaultActiveTab="Design"
        aria-label="Workflow"
      />
    </LuminescentProvider>
  );
}

Switch between light and dark in the preview, or open the playground for a larger workspace. Custom CSS variables can override spacing, color, typography and effects.

Related components