Selectable radio cards for a subscription checkout, built with Bootstrap 6's new .form-field-card. Plans are large price cards, shipping options are compact rows with icons, and a dark summary bar shows the total. The same pattern works for pricing plans, delivery methods, payment options or onboarding questions.
How it works
Every option is a .form-field.form-field-card that holds a native <input type="radio" class="radio"> and a .form-field-content column with the <label>. Bootstrap 6 places an absolutely positioned label::before over the card, so a click anywhere selects the radio. Radios with the same name (rbc-plan, rbc-ship) form two groups inside a <fieldset> with a numbered <legend class="rbc-legend">.
Selection styling is pure CSS. .form-field-card:has(:checked) gets the violet border, tint and shadow. .rbc-row:has(:checked) .rbc-icon fills the shipping icon. Plan cards (.rbc-card) move the radio to the top right with grid placement. Shipping rows (.rbc-row) lay out radio, icon, text and fee in one line on phones, and a stacked grid from 768 px.
Each radio has data-rbc-price and data-rbc-label. On any change, script.js adds both prices and writes the result into .rbc-summary and .rbc-sum. Submitting the form calls preventDefault(), disables .rbc-submit and shows a short "Saving" message. Then it confirms the choice in .rbc-status.
Customization
--rbc-brandand--rbc-brand-softon.rbc-root: recolor checked cards, radios, icons, step badges and the button.data-rbc-priceon each radio: set the monthly price or shipping fee used for the total.data-rbc-labelon each radio: change the name shown in the summary bar.- Move
checkedto another radio to change the default plan, for example to highlight Starter. - Replace the
setTimeoutin the submit handler withfetch(). A comment shows aFormDataexample. - Change
repeat(3, …)in themin-width: 768pxrule of.rbc-plansto fit two or four plans.
Use cases
- Subscription checkouts: large price cards let visitors choose a plan with one click
- Delivery method selection: compact rows with icons and fees show shipping options
- Onboarding questions: the whole card is clickable and highlights when selected
- Order summaries: a dark summary bar adds the plan and shipping prices into a live total
Accessibility
Native radios keep the expected keyboard behavior. Tab enters each group, and the arrow keys move the selection. The whole card shows a focus ring through :has(:focus-visible). The "Most popular" badge is linked to the Plus radio with aria-describedby. The total is aria-live="polite", and .rbc-status uses role="status". Card transitions are turned off under prefers-reduced-motion.
Bootstrap 6 notes
Bootstrap 5 needed .btn-check tricks or custom CSS for card radios. Bootstrap 6 ships .form-field-card, .form-field-content and the .radio input. The button is btn-solid theme-primary, and the badge is badge theme-accent. Built on Bootstrap 6.0.0-alpha.1, which may still change. Icons come from Bootstrap Icons.