Segmented control

Compact switch between a few views, like day, week and month.

CSS onlyKeyboard
BackgroundGridAccent

Corners

SharpDefaultRound

Shadow

NoneNoneStrong

Motion

NoneDefaultBounce
<style>
.ux-seg{display:inline-flex;padding:4px;border-radius:var(--rp,999px);background:var(--soft,#eceef3)}
.ux-seg input{position:absolute;opacity:0}
.ux-seg label{padding:8px 16px;border-radius:var(--rp,999px);cursor:pointer;font:500 14px system-ui;color:var(--muted,#6b6f7b);transition:background var(--dur,.2s) var(--ease,ease),color var(--dur,.2s) var(--ease,ease)}
.ux-seg input:checked+label{background:var(--accent,#cc4a26);color:#fff}
.ux-seg input:focus-visible+label{outline:2px solid var(--accent,#cc4a26);outline-offset:2px}
</style>

<div class="ux-seg" role="radiogroup" aria-label="Period">
  <input type="radio" name="ux-seg" id="ux-seg-d"><label for="ux-seg-d">Day</label>
  <input type="radio" name="ux-seg" id="ux-seg-w" checked><label for="ux-seg-w">Week</label>
  <input type="radio" name="ux-seg" id="ux-seg-m"><label for="ux-seg-m">Month</label>
  <input type="radio" name="ux-seg" id="ux-seg-y"><label for="ux-seg-y">Year</label>
</div>

When to use it

Reach for this when someone has to pick from a small, visible set of options rather than typing free text. It works best when every choice fits on screen at once.

Accessibility

It is fully keyboard operable: tab to it and use the keys you would expect (space, enter or the arrow keys) to change its value, with a visible focus ring so sighted keyboard users can always see where they are. It has no JavaScript dependency, so it keeps working if a script fails to load, and it is built on native form controls or semantics rather than divs pretending to be one. Colors are read from CSS custom properties, so they follow your light or dark theme and you can raise contrast globally without touching this component.