HextaUI

Segmented control (UI SDK): Read-only

A read-only control keeps its value and still submits. Arrow keys move focus without checking anything.

import {
  SegmentedControl,
  SegmentedControlItem,
} from "@/components/ui/ui-sdk-segmented-control"

function UiSdkSegmentedControlReadOnly() {
  return (
    <SegmentedControl aria-label="Plan" defaultValue="team" readOnly>
      <SegmentedControlItem value="solo">Solo</SegmentedControlItem>
      <SegmentedControlItem value="team">Team</SegmentedControlItem>
    </SegmentedControl>
  )
}

export { UiSdkSegmentedControlReadOnly }

This adds the example as components/examples/ui-sdk-segmented-control/read-only.tsx, together with the Segmented control component and the HextaUI theme tokens it needs.

pnpm dlx shadcn@latest add https://hextaui.com/r/ui-sdk-segmented-control-read-only.json

To add only the component, follow the Segmented control installation.

Props in this example

The Segmented control props this example sets, from the API reference.

PropTypeDefault
defaultValue
T | null–
readOnly
booleanfalse
PropTypeDefault
value
string–

Every prop is in the Segmented control API reference.

See them all, with keyboard support and accessibility notes, on the Segmented control page.