LayerwiseLayerwise
  • Features
  • Pricing
  • Templates
  • Docs
DownloadDownload
FeaturesPricingTemplatesDocsAI Website BuilderVibe CodingPersonal Software
DownloadDownload
  1. Glossary
  2. /
  3. Components

Segmented control

Also called segmented button or toggle button group

A compact row of two to five options in one pill-shaped track, where a sliding thumb marks the single selected option.

import { useId, useState } from 'react';
import { motion } from 'motion/react';
import { Radio } from '@base-ui/react/radio';
import { RadioGroup } from '@base-ui/react/radio-group';

const RANGES = ['Day', 'Week', 'Month'] as const;
type Range = (typeof RANGES)[number];

// Stiff and well damped: the thumb settles in about 250ms with no bounce.
const THUMB_SPRING = { type: 'spring', stiffness: 500, damping: 40 } as const;

export function ChartRangeControl() {
  const [range, setRange] = useState<Range>('Week');
  const id = useId();

  // A radio group: one choice among several, with arrow-key support.
  return (
    <RadioGroup
      value={range}
      onValueChange={setRange}
      aria-label='Chart range'
      className='inline-flex rounded-lg bg-muted p-0.5'
    >
      {RANGES.map((option) => (
        <Radio.Root
          key={option}
          value={option}
          className='relative flex h-8 cursor-default items-center rounded-md px-4 text-sm font-medium text-muted-foreground outline-none select-none focus-visible:ring-2 focus-visible:ring-ring data-checked:text-foreground'
        >
          {option === range && (
            <motion.span
              layoutId={`${id}-thumb`}
              transition={THUMB_SPRING}
              className='absolute inset-0 rounded-md bg-background shadow-sm'
            />
          )}
          <span className='relative'>{option}</span>
        </Radio.Root>
      ))}
    </RadioGroup>
  );
}
Replace the Day, Week, and Month buttons above the chart with an iOS-style segmented control: a gray pill track with a white raised thumb that slides to the selected option using a spring (stiffness 500, damping 40). Make it a radio group so the arrow keys change the selection, and make each segment at least 32px tall.

Paste into Layerwise or any AI coding tool.

What is Segmented control?

A segmented control looks like a set of buttons fused into one rounded track. Exactly one segment is selected, and a raised thumb slides under it when you pick another. It comes from iOS, where it switches views such as Day, Week, and Month.

Use it to switch between a few views or modes of the same content: List and Grid, Monthly and Yearly pricing, or Day and Week in a chart. Keep it to about five short labels. To move between different sections of a page, use tabs, and for a setting that is simply on or off, use a toggle switch.

The sliding thumb is the signature detail. Move it with a spring that settles in about 250 to 300ms with little or no bounce, and compare it with an instant jump in the demo. Build it as a radio group with arrow-key support so screen readers announce it as one choice among several.

Often confused with

Tabs
Tabs move between different sections of content. A segmented control changes how the same content is shown.
Radio button
Both pick exactly one option. A segmented control packs a few short options into one compact bar, while radio buttons list them with room for longer labels and details.

Related terms

All terms

Tabs

A row of labels that switches between panels of related content in the same spot, showing one panel at a time.

Radio button

A round option in a group where choosing one clears the others, so people pick exactly one answer, like a plan or a shipping speed.

Spring animation

An animation driven by simulated spring physics in place of a fixed duration and curve, so motion can overshoot, settle, and react naturally.

Layout animation

An animation that smoothly moves and resizes elements when the layout changes, such as list items gliding to new spots after a sort or filter.

Build it with Layerwise

Describe your app, watch it run in a live preview, and publish it with a database, storage, and sign-in built in.

DownloadDownloadRead the docs
LayerwiseLayerwise

Build full-stack web apps in minutes with AI.

Product

  • Features
  • Pricing
  • Download
  • Templates

Solutions

  • AI Website Builder
  • Vibe Coding
  • Personal Software

Resources

  • Documentation
  • Changelog
  • Blog
  • Vibe Coding Glossary
  • llms.txt
  • llms-full.txt

Company

  • About
  • Contact

Legal

  • Privacy
  • Analytics Privacy
  • Terms
  • Security
  • Abuse

© 2026 Layerwise. All rights reserved.

Entrances & exits

  • Fade in
  • Slide in
  • Scale in
  • Pop in
  • Blur in
  • Reveal animation
  • Enter and exit animations

Timing & sequencing

  • Duration
  • Delay
  • Keyframes
  • Tweening
  • Stagger
  • Orchestration
  • Fill mode
  • Stepped animation
  • Looping animation
  • Yoyo animation

Easing

  • Easing
  • Linear easing
  • Ease-in
  • Ease-out
  • Ease-in-out
  • Cubic-bezier
  • Asymmetric easing
  • Overshoot easing

Springs & physics

  • Spring animation
  • Stiffness
  • Damping
  • Mass
  • Bounce
  • Velocity
  • Momentum
  • Interruptible animation
  • Rubber-banding

Transforms

  • Translate
  • Scale
  • Rotate
  • Skew
  • 3D flip
  • Perspective
  • Transform origin
  • Origin-aware animation

State transitions

  • Crossfade
  • Morph
  • Shared element transition
  • Layout animation
  • Height auto animation
  • Direction-aware transition
  • Continuity transition
  • Page transition
  • View Transitions API

Scroll effects

  • Scroll reveal
  • Scroll-driven animation
  • Parallax scrolling
  • Scrollytelling
  • Scroll pinning
  • Horizontal scroll section
  • Scroll progress bar
  • Scroll snap
  • Smooth scrolling

Interaction feedback

  • Hover effect
  • Press feedback
  • Ripple effect
  • Shake animation
  • Hold to confirm
  • Drag gesture
  • Drag to reorder
  • Swipe to dismiss
  • Pull to refresh
  • Magnetic button
  • Custom cursor
  • 3D tilt card
  • Spotlight card

Text effects

  • Typewriter effect
  • Text scramble
  • Split text animation
  • Text morph
  • Rotating words
  • Gradient text
  • Shimmer text
  • Number ticker
  • Tabular numbers
  • Underline animation

Loops & ambient motion

  • Marquee
  • Pulse animation
  • Float animation
  • Orbit animation
  • Idle animation
  • Particle background
  • Border beam
  • Confetti
  • Animated gradient

Visual effects

  • Blur
  • Clip-path
  • Mask
  • Before/after slider
  • SVG line drawing
  • Lottie animation

Motion principles

  • Purposeful animation
  • Anticipation
  • Follow-through
  • Squash and stretch
  • Perceived performance
  • Frequency of use
  • Spatial consistency
  • Reduced motion

Animation performance

  • Frame rate (FPS)
  • Jank
  • GPU acceleration
  • will-change
  • Layout thrashing

Layout

  • Hero section
  • Above the fold
  • Sticky header
  • Sidebar
  • Bento grid
  • Card
  • Flexbox
  • CSS Grid
  • Padding vs margin
  • Responsive design
  • Container
  • Masonry layout
  • Split screen
  • Z-index
  • Overflow

Components

  • Button variants
  • Modal
  • Drawer
  • Popover
  • Tooltip
  • Dropdown menu
  • Context menu
  • Toast notification
  • Tabs
  • Segmented control
  • Accordion
  • Carousel
  • Command palette
  • Combobox
  • Toggle switch
  • Checkbox
  • Radio button
  • Date picker
  • Breadcrumb
  • Pagination
  • Infinite scroll
  • Badge
  • Avatar stack
  • Empty state
  • Skeleton screen
  • Spinner
  • Progress bar
  • Data table
  • Stepper
  • Floating label
  • Inline validation
  • Alert banner
  • Tag input

States & patterns

  • Interaction states
  • Focus ring
  • Loading state
  • Optimistic UI
  • Debounce
  • Lazy loading
  • Dark mode
  • Micro-interaction
  • Affordance
  • Undo
  • Drag and drop
  • Keyboard shortcut

Visual styles

  • Glassmorphism
  • Liquid glass
  • Neumorphism
  • Claymorphism
  • Neo-brutalism
  • Skeuomorphism
  • Flat design
  • Mesh gradient
  • Aurora background
  • Grain texture
  • Glow effect
  • Drop shadow
  • Border radius
  • Grid background
  • Typographic hierarchy
  • Accent color
  • Color contrast

Vibe coding & AI

  • Vibe coding
  • Prompt
  • Context window
  • Token
  • AI agent
  • Tool call
  • Hallucination
  • Diff
  • Live preview
  • Checkpoint
  • Git commit
  • Deploy
  • Frontend and backend
  • API
  • Database
  • Rules file
  • MCP
  • Plan mode
  • Visual edit
Visitors1,240