Once UI Handbook
Vibe coding
Introduction to vibe coding
Set up your local dev environment
Essential tools for vibe coding
Build your first Once UI app
Getting started
What is Once UI?
Install & config
Page skeleton
Your first page
Upgrade from 1.8 to 2.0
Once UI without Next.js
Build and launch
How to launch a portfolio site that actually gets you hired
How to build a documentation site with MDX and Next.js
How to ship a landing page and dashboard with authentication in Next.js
How to launch a social app with Next.js and Supabase
Common patterns
Hero section
Static panel
Form layout
Highlighted card
Responsive stacking
Decoration layers
Dialog & modal
Toast & feedback
Tables & lists
Loading states
App shell navigation
Dashboard & charts
Chat & messaging
Auth & verification
Settings & split panels
Data filters & toolbar
Command palette
Pricing & plans
Accordion & FAQ
Media & uploads
Empty & error states
SEO, Open Graph, and structured data
Documentation code blocks with live preview
Carousels, galleries, and before/after comparisons
Date pickers and scheduling
Context menus and dropdown actions
Tags, chips, and multi-value inputs
Roadmap & kanban
Form inputs & controls
Progress, status & badges
Scrolling & feeds
Profile, avatars & identity
Social proof & logo clouds
Masonry & media grids
Table pagination, search & bulk selection
Banners & announcements
Footer layouts
Onboarding & first run
Waitlist & coming soon
Forms that wire themselves
An icon rail that opens on hover
Maps without an API key
Segmented controls that slide
Design tips
Color & surfaces
Harness overview
Row, Column & Grid
Spacing & rhythm
Icons & buttons
Reveal & motion
Theme tokens, FOUC-free init, and runtime style controls
Tooltips and hover cards
Border radius & nested corners
Bring your own icons
Give one section its own style
Override Once UI styles without !important
A logo before you have one
Agent resources
Column, not Flex
Semantics over CSS
Typography scale
Common gotchas
Block anchors
Validate generated code
Pro block registry
Match task bundles
Block updates
Block updates changelog
TrademarkTrademark
Ctrl k
Search…
Sign up
Once UI Handbook
Vibe coding
Introduction to vibe coding
Set up your local dev environment
Essential tools for vibe coding
Build your first Once UI app
Getting started
What is Once UI?
Install & config
Page skeleton
Your first page
Upgrade from 1.8 to 2.0
Once UI without Next.js
Build and launch
How to launch a portfolio site that actually gets you hired
How to build a documentation site with MDX and Next.js
How to ship a landing page and dashboard with authentication in Next.js
How to launch a social app with Next.js and Supabase
Common patterns
Hero section
Static panel
Form layout
Highlighted card
Responsive stacking
Decoration layers
Dialog & modal
Toast & feedback
Tables & lists
Loading states
App shell navigation
Dashboard & charts
Chat & messaging
Auth & verification
Settings & split panels
Data filters & toolbar
Command palette
Pricing & plans
Accordion & FAQ
Media & uploads
Empty & error states
SEO, Open Graph, and structured data
Documentation code blocks with live preview
Carousels, galleries, and before/after comparisons
Date pickers and scheduling
Context menus and dropdown actions
Tags, chips, and multi-value inputs
Roadmap & kanban
Form inputs & controls
Progress, status & badges
Scrolling & feeds
Profile, avatars & identity
Social proof & logo clouds
Masonry & media grids
Table pagination, search & bulk selection
Banners & announcements
Footer layouts
Onboarding & first run
Waitlist & coming soon
Forms that wire themselves
An icon rail that opens on hover
Maps without an API key
Segmented controls that slide
Design tips
Color & surfaces
Harness overview
Row, Column & Grid
Spacing & rhythm
Icons & buttons
Reveal & motion
Theme tokens, FOUC-free init, and runtime style controls
Tooltips and hover cards
Border radius & nested corners
Bring your own icons
Give one section its own style
Override Once UI styles without !important
A logo before you have one
Agent resources
Column, not Flex
Semantics over CSS
Typography scale
Common gotchas
Block anchors
Validate generated code
Pro block registry
Match task bundles
Block updates
Block updates changelog
TrademarkTrademark
Once UIDocumentationBlog
© Once UI. All rights reserved.
Built with Aveiro
Common Patterns

Segmented controls that slide

How to set up SegmentedControl: the sliding selection, tabs versus radio semantics, a non-scrolling row for narrow sidebars, and a second line of description per option.
Updated yesterday
Maps without an API key
4 min · Pattern · SegmentedControl
From @once-ui-system/core 2.8.0, the selected background in SegmentedControl slides between options. This page also covers the props that decide how the control behaves: semantics, scroll and description.

The basic control

A segmented control is a short row of options where exactly one is picked. A period switch on a chart, a status filter above a table, monthly or yearly on a pricing page. Pass value and onChange for a controlled control, or only defaultValue when nothing outside needs to know. If you are porting 1.x code, the old names selected, onToggle and defaultSelected are gone.

The selection slides

In 2.8.0 the selected background no longer jumps to the new option. It slides there. This is on by default, so upgrading is enough. A few things worth knowing:
  • Reduced motion is respected. Visitors who ask for reduced motion see the selection move without the slide.
  • compact does not slide. Its joined segments carry their own corners, so the slide is skipped there.
  • You can turn it off. Set sliding={false} if you want the old jump, for example in a dense toolbar.

Tabs or radio

By default the control is a tab strip for assistive technology: arrow keys move focus, Enter or Space selects. That is right when the options switch between views of the same content. When the options are a setting instead, a choice that gets saved, use semantics="radio". The control becomes a radio group, and the arrow keys move focus and select at the same time, the way native radios do. Either way, name the control with aria-label or aria-labelledby. A row of buttons that says "Day, Week, Month" means nothing to a screen reader without it.
Use
When the options
tabs (default)
Switch the view: a chart period, a table filter
radio
Set a value: billing period, a theme, a saved preference

Narrow spaces

The control scrolls sideways by default, which is fine in a wide header. In a narrow sidebar it is not: two or three options scroll behind a Next button and the last one gets clipped. Set scroll={false} there. The options sit in a plain row that shares the width (equally with fillWidth), and a label that does not fit is truncated instead of hidden.

A second line per option

Each option can take a description, a dimmer line under the label. The option grows to fit both. It works well for a choice that needs one word of context, like a plan or a mode. Keep it to a few words. If an option needs a sentence, it probably wants a radio card or a Select instead.

Check yourself

  • The control has an aria-label or aria-labelledby
  • semantics="radio" when the choice is a saved setting
  • scroll={false} in sidebars and other narrow columns
  • Two to five options; more than that is a Select
More patterns live in this section.
import { SegmentedControl } from "@once-ui-system/core";

<SegmentedControl
  aria-label="Period"
  defaultValue="week"
  buttons={[
    { value: "day", label: "Day" },
    { value: "week", label: "Week" },
    { value: "month", label: "Month" },
  ]}
  onChange={(value) => setPeriod(value)}
/>
<SegmentedControl sliding={false} buttons={buttons} />
<SegmentedControl
  semantics="radio"
  aria-label="Billing"
  value={billing}
  onChange={setBilling}
  buttons={[
    { value: "monthly", label: "Monthly" },
    { value: "yearly", label: "Yearly" },
  ]}
/>
<SegmentedControl scroll={false} fillWidth buttons={buttons} />
buttons={[
  { value: "draft", label: "Draft", description: "Only you" },
  { value: "team", label: "Team", description: "Your workspace" },
  { value: "public", label: "Public", description: "Anyone with the link" },
]}