Checkout rows for picking a delivery speed. Each row is a label with a ring, an estimate and a price; the chosen one gets an accent border, a tinted fill and a dot that springs in.
Also known as: shipping options radio css, checkout radio cards, delivery method selector css.
<div class="rad-shipping-method-cards" role="radiogroup" aria-label="Shipping method">
<label>
<input type="radio" name="rad-shipping-method-cards" value="standard" checked>
<span class="rad-shipping-method-cards-ring" aria-hidden="true"></span>
<span class="rad-shipping-method-cards-text">Standard <small>4 to 6 days</small></span>
<span class="rad-shipping-method-cards-price">Free</span>
</label>
<label>
<input type="radio" name="rad-shipping-method-cards" value="express">
<span class="rad-shipping-method-cards-ring" aria-hidden="true"></span>
<span class="rad-shipping-method-cards-text">Express <small>2 days</small></span>
<span class="rad-shipping-method-cards-price">$9.90</span>
</label>
<label>
<input type="radio" name="rad-shipping-method-cards" value="overnight">
<span class="rad-shipping-method-cards-ring" aria-hidden="true"></span>
<span class="rad-shipping-method-cards-text">Overnight <small>tomorrow</small></span>
<span class="rad-shipping-method-cards-price">$24</span>
</label>
</div>.rad-shipping-method-cards {
--c: var(--rad-color, #3b82f6);
font-size: var(--rad-size, 18px);
display: grid;
gap: 0.45em;
width: 17em;
font-family: system-ui, sans-serif;
line-height: 1.2;
}
.rad-shipping-method-cards label {
position: relative;
display: flex;
align-items: center;
gap: 0.7em;
padding: 0.6em 0.85em;
border: 1px solid color-mix(in srgb, currentColor 15%, transparent);
border-radius: 0.7em;
cursor: pointer;
transition: border-color 0.25s ease, background-color 0.25s ease, box-shadow 0.25s ease;
}
.rad-shipping-method-cards label:hover {
border-color: color-mix(in srgb, var(--c) 55%, transparent);
}
.rad-shipping-method-cards label:has(:checked) {
border-color: var(--c);
background: color-mix(in srgb, var(--c) 8%, transparent);
box-shadow: 0 0 0 1px var(--c);
}
.rad-shipping-method-cards label:has(:focus-visible) {
outline: 0.12em solid var(--c);
outline-offset: 0.2em;
}
.rad-shipping-method-cards input {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
margin: 0;
opacity: 0;
cursor: pointer;
z-index: 1;
}
.rad-shipping-method-cards-ring {
display: grid;
place-items: center;
flex: none;
box-sizing: border-box;
width: 1.1em;
height: 1.1em;
border: 0.12em solid color-mix(in srgb, currentColor 30%, transparent);
border-radius: 50%;
transition: border-color 0.25s ease;
}
.rad-shipping-method-cards-ring::after {
content: "";
width: 0.48em;
height: 0.48em;
border-radius: 50%;
background: var(--c);
transform: scale(0);
transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.rad-shipping-method-cards input:checked + .rad-shipping-method-cards-ring {
border-color: var(--c);
}
.rad-shipping-method-cards input:checked + .rad-shipping-method-cards-ring::after {
transform: scale(1);
}
.rad-shipping-method-cards-text {
flex: 1;
font-size: 0.9em;
font-weight: 600;
}
.rad-shipping-method-cards-text small {
margin-left: 0.3em;
font-size: 0.8em;
font-weight: 400;
color: color-mix(in srgb, currentColor 55%, transparent);
}
.rad-shipping-method-cards-price {
font-size: 0.9em;
font-weight: 600;
font-variant-numeric: tabular-nums;
transition: color 0.25s ease;
}
.rad-shipping-method-cards input:checked ~ .rad-shipping-method-cards-price {
color: var(--c);
}
@media (prefers-reduced-motion: reduce) {
.rad-shipping-method-cards, .rad-shipping-method-cards *, .rad-shipping-method-cards::before, .rad-shipping-method-cards::after, .rad-shipping-method-cards *::before, .rad-shipping-method-cards *::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}--rad-color on the element or a parent.
Currently previewing #3b82f6.--rad-size. Every other dimension is in
em, so the whole thing scales together. Currently previewing 18px.transition or animation
shorthand. Staggered delays are relative, so they keep their rhythm.