Components / Selects and toggles
View switcher with icons
A segmented control with an icon per view and a thumb that slides to the chosen one. Labels drop away in a narrow space and the icons stay.
Orders
38 open orders, newest first38 open orders in 4 stages38 open orders over 9 delivery days38 open orders, 31 inside the ring road
The code
Plain HTML and CSS on your kit's variables. Put it next to tokens/variables.css from your kit's files and it draws in your look.
<div class="ukc-toggle-view-switcher">
<div class="vs">
<div class="hd">
<p class="ttl">Orders</p>
<div class="seg" role="radiogroup" aria-label="View orders as">
<label><input class="v1" type="radio" name="ukc-toggle-view-switcher-view"><span><svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 6h16M4 12h16M4 18h16"/></svg><span class="tx">List</span></span></label>
<label><input class="v2" type="radio" name="ukc-toggle-view-switcher-view" checked><span><svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="4" y="4" width="6" height="16" rx="1"/><rect x="14" y="4" width="6" height="10" rx="1"/></svg><span class="tx">Board</span></span></label>
<label><input class="v3" type="radio" name="ukc-toggle-view-switcher-view"><span><svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="5" width="18" height="16" rx="1"/><path d="M3 10h18M8 3v4M16 3v4"/></svg><span class="tx">Calendar</span></span></label>
<label><input class="v4" type="radio" name="ukc-toggle-view-switcher-view"><span><svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 21s-7-6.2-7-11.5a7 7 0 0 1 14 0C19 14.8 12 21 12 21z"/><circle cx="12" cy="9.5" r="2.5"/></svg><span class="tx">Map</span></span></label>
</div>
</div>
<p class="st" aria-live="polite"><span class="s1">38 open orders, newest first</span><span class="s2">38 open orders in 4 stages</span><span class="s3">38 open orders over 9 delivery days</span><span class="s4">38 open orders, 31 inside the ring road</span></p>
</div>
</div>
.ukc-toggle-view-switcher { position: relative; font-family: var(--uk-font-body, system-ui, sans-serif); color: var(--uk-ink); font-size: 15px; line-height: 1.5;
--tint: color-mix(in srgb, var(--uk-accent) 12%, var(--uk-paper));
--tint-strong: color-mix(in srgb, var(--uk-accent) 22%, var(--uk-paper));
--accent-deep: color-mix(in srgb, var(--uk-accent) 72%, black);
--ink-soft: color-mix(in srgb, var(--uk-ink) 8%, var(--uk-paper));
--line-strong: color-mix(in srgb, var(--uk-ink) 32%, var(--uk-paper));
--danger-tint: color-mix(in srgb, var(--uk-danger) 12%, var(--uk-paper));
--high-tint: color-mix(in srgb, var(--uk-highlight) 28%, var(--uk-paper)); }
.ukc-toggle-view-switcher *, .ukc-toggle-view-switcher *::before, .ukc-toggle-view-switcher *::after { box-sizing: border-box; }
.ukc-toggle-view-switcher :where(h1, h2, h3, h4, p, ul, ol, dl, dd, figure, blockquote) { margin: 0; }
.ukc-toggle-view-switcher :where(ul, ol) { padding: 0; list-style: none; }
.ukc-toggle-view-switcher :where(button, input, select, textarea) { font: inherit; color: inherit; }
.ukc-toggle-view-switcher :where(a) { color: inherit; }
.ukc-toggle-view-switcher svg { flex: none; }
.ukc-toggle-view-switcher { container-type: inline-size; inline-size: 100%; }
.ukc-toggle-view-switcher .vs { max-width: 520px; display: grid; gap: 10px; }
.ukc-toggle-view-switcher .hd { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.ukc-toggle-view-switcher .ttl { font-family: var(--uk-font-display, inherit); font-size: 20px; font-weight: 600; }
.ukc-toggle-view-switcher .seg { position: relative; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 3px; border: var(--uk-border-width) solid var(--uk-line); border-radius: var(--uk-radius-md); background: var(--ink-soft); }
.ukc-toggle-view-switcher .seg::before { content: ""; position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc((100% - 6px) / 4); border-radius: calc(var(--uk-radius-md) - 3px); background: var(--uk-paper); box-shadow: 0 0 0 1px var(--line-strong); transition: transform var(--uk-motion-duration) var(--uk-motion-ease); }
.ukc-toggle-view-switcher:has(.v2:checked) .seg::before { transform: translateX(100%); }
.ukc-toggle-view-switcher:has(.v3:checked) .seg::before { transform: translateX(200%); }
.ukc-toggle-view-switcher:has(.v4:checked) .seg::before { transform: translateX(300%); }
.ukc-toggle-view-switcher .seg label { position: relative; cursor: pointer; }
.ukc-toggle-view-switcher .seg input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: inherit; }
.ukc-toggle-view-switcher .seg label > span { display: flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: calc(var(--uk-radius-md) - 3px); color: var(--uk-muted); font-size: 13px; white-space: nowrap; }
.ukc-toggle-view-switcher .seg label:hover > span { color: var(--uk-ink); }
.ukc-toggle-view-switcher .seg input:checked + span { color: var(--uk-ink); font-weight: 600; }
.ukc-toggle-view-switcher .seg input:focus-visible + span { outline: 2px solid var(--uk-accent); outline-offset: 1px; }
.ukc-toggle-view-switcher .st { font-size: 13px; color: var(--uk-muted); }
.ukc-toggle-view-switcher .st span { display: none; }
.ukc-toggle-view-switcher:has(.v1:checked) .s1, .ukc-toggle-view-switcher:has(.v2:checked) .s2, .ukc-toggle-view-switcher:has(.v3:checked) .s3, .ukc-toggle-view-switcher:has(.v4:checked) .s4 { display: inline; }
@container (max-width: 440px) { .ukc-toggle-view-switcher .tx { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); } .ukc-toggle-view-switcher .seg label > span { padding: 0 14px; } }
@media (prefers-reduced-motion: reduce) { .ukc-toggle-view-switcher .seg::before { transition: none; } }
More selects and toggles
All 28The Third Man
Sat 8:15 pm · Screen 2 · Roxy Lane Cinema
- Free
- Yours
- Taken
$11 each
Unlimited classes · Kiln Street Yoga
$118$98a month
Billed each month. Pause or cancel any time.Billed as $1,176 once a year, mat hire included.
Monthly Yearly Save $240- Email notificationsWeekly digest
Auto-send invoices
OnRound hours up
Off