Segmented Control Time Slots
Lay the options out in several rows, like a time slot picker. ::part(container) becomes a wrapping grid, the --sv-segmented-control-bg, --sv-segmented-control-bdr-sz, and --sv-segmented-control-pad variables remove the surface, and a disabled button marks a taken slot.
The indicator slides between rows.
Code
The following example assumes that you have imported the component and set up the theme.
<sv-segmented-control class="segmented-time-slots" aria-label="Pick a time" value="10:00">12 collapsed lines
<button value="09:00">9:00</button> <button value="09:30">9:30</button> <button value="10:00">10:00</button> <button value="10:30">10:30</button> <button disabled value="11:00">11:00</button> <button value="11:30">11:30</button> <button value="13:00">13:00</button> <button value="13:30">13:30</button> <button disabled value="14:00">14:00</button> <button value="14:30">14:30</button> <button value="15:00">15:00</button> <button value="15:30">15:30</button></sv-segmented-control>
<style>38 collapsed lines
.segmented-time-slots { --sv-segmented-control-bg: transparent; --sv-segmented-control-bdr-sz: 0; --sv-segmented-control-pad: 0px; --sv-segmented-control-bdr-rad: 999px;
max-inline-size: 24rem; margin-inline: auto;
/* Rows of equal columns that wrap to fit the width */ &::part(container) { display: grid; grid-template-columns: repeat(auto-fill, minmax(4.5em, 1fr)); gap: 0.6em; }
button { padding-block: 0.55em; font: inherit; font-weight: 500; font-variant-numeric: tabular-nums;
/* A ring above both the sliding and the resting fill. It never changes at the handoff. */ &::after { position: absolute; inset: 0; pointer-events: none; content: ""; border: 1px solid color-mix(in srgb, currentcolor 20%, transparent); border-radius: inherit; }
/* Unavailable slots */ &:disabled::after { border-style: dashed; } } }</style>