Quaff

QRadio

Radio buttons select one option from a visible set of alternatives. Related buttons share a selected value and group name.

BOOKING OPTIONS
Session length
info QRadio API Source

interface QRadioProps extends HTMLAttributes<HTMLLabelElement>

disabled
?: boolean = false
When true, prevents user interaction with the radio button.

label
?: string = ""
Text label displayed next to the radio button.

name
?: string = undefined
Native name used to group radio buttons for keyboard navigation and form submission.

selected
?: QRadioValue = $bindable(undefined)
Bound value that determines if this radio button is selected. This prop is bindable. When using a group of radio buttons, this should be the same variable for all of them.

value
: QRadioValue = ""
Value associated with this radio button. Used when comparing against the selected value.

Usage

Values, Binding and Events
Give every option a value, share a name, and use the same bind:selected value for the group. Generate options with an each block. onchange responds to user selection; assigning the bound value updates the group without firing it.
Session length

Choose an option to see its change event.

Selected value: 1h

Numeric Values and Disabled Options
Radio values can be numbers too. In a list, stretch the radio label to give each option a generous selection area. Use preserveTabOrder on the list to keep native radio keyboard navigation. disabled marks unavailable choices or a fixed selection.
Choose a table

Selected value: 4 (number)

Disabled selection

This selection is fixed and cannot be changed.

Boolean Values and Horizontal Layout
Both false and true are valid radio values. Use Quaff's flex and gap helpers to arrange short choices horizontally; they wrap when space is limited.
Booking frequency

Selected value: false (boolean)

Form Submission
name is also the form field name. Only the checked, enabled radio is submitted. FormData reads its value as a string, even when the bound value is a number or boolean.
Booking updates

Submit to read the selected value.

Accessibility

Group related radios in a fieldset with a legend. Give each option a visible label and share a name within the group.

Tab enters or leaves a group; arrow keys move focus and select an option. Space selects the focused radio; Enter does not select it. Disabled options are skipped. Keep focus indicators visible and avoid nested interactive controls.