Design System

Radio reference ​

Every prop, event and attribute CRadio accepts, and the markup it renders. For how to apply it, see Usage.

Props ​

PropTypeRequiredDefaultMeaning
modelValueT, defaulting to stringYesBound with v-model. Checked where it is not null and equals value, so undefined and null both render unchecked
labelstringYesThe words beside the circle, rendered as the text of the <label>
valueunknownYesThe value this option selects. Typed unknown rather than to the model's type
namestringNoundefinedThe native radio group key, written to <input name>
hideLabelbooleanNofalseAdds sr-only to the label, keeping its text and its for
disabledbooleanNofalseSets <input disabled> and adds opacity-disabled to the label

T types the model alone. The declaration is defineModel<T>({ required: true }), so a model typed T | undefined fails typecheck.

Events ​

EventPayloadDeclared on the component
update:modelValueT, the value of the option activatedYes, through defineModel
changeEventNo, arriving through the listener branch of the forwarding filter
focusFocusEventNo, same route as change
blurFocusEventNo, same route as change

update:modelValue is not emitted while disabled, and not emitted when the activated option is already checked, since the browser fires no change event in that case.

Slots ​

The template holds no <slot> element of any kind, so content written between the tags renders nothing. The label comes from the label prop.

Sizes and severities ​

size, severity, variant and invalid are not props here, and none of them is forwardable, so the preset branch for an invalid radio cannot fire. The component varies over state rather than over an axis: checked, unchecked, hover, focus-visible and disabled.

Markup ​

html
<div class="flex items-center gap-2">
  <div data-pc-name="radiobutton" data-pc-section="root" data-p-checked data-p-disabled>
    <input data-pc-section="input" type="radio" id value name checked disabled />
    <div data-pc-section="box"><div data-pc-section="icon"></div></div>
  </div>
  <label for="[id of the input]">[label]</label>
</div>
ElementJob
Wrapper divHolds the circle and the label 8 pixels apart, and receives nothing from the caller
Library root divThe 20 by 20 box carrying forwarded data-*, listeners and form
inputThe real control, at zero opacity, filling the root
Box divThe circle on screen, 20 by 20, rounded-full
Icon divThe dot, 12 by 12, empty
labelRendered on every pass, carrying for against the input's id

Accessibility ​

Value
RoleThe implicit radio of <input type="radio">
Accessible nameThe native for association with the rendered label
idGenerated per instance, or the caller's id when one is passed
role="radiogroup"Not written by the component and not written at any call site
aria-labelledby, aria-label, aria-invalidAbsent by default, since the component passes none of them and invalid cannot be reached, though a forwarded aria-* attribute lands on the input
Group behaviourNative, and present where the options share a name
Pointer target20 by 20 for the circle, plus the label where it is visible

Attribute forwarding ​

ShapeWhere it lands
idTaken by the component, used on the input and on the label's for
aria-*The input
data-*The library root div
on[A-Z] listenersThe library root div, which is the circle rather than the wrapper
namePassed as a prop, reaching <input name>
formThe library root div, where it associates nothing

The filter is the pattern /^(data-|aria-|on[A-Z])|^(id|name|form)$/ and the component sets inheritAttrs: false, so class, style, pt, labelClass, title, tabindex, role, readonly, binary, variant, inputClass and inputStyle reach no element. A test in the component layer pins that for class, labelClass and pt.

Geometry ​

Value
Circle20 by 20 pixels
Dot12 by 12 pixels
Gap from circle to label8 pixels
Circle border1 pixel, rounded-full
Label typetext-caption, rendering 12 pixels over 16 at the interface default
Focus ring2 pixels at a 2 pixel offset, 28 pixels across at its outer edge
Transition200ms on the border and the dot, from the preset rather than the motion tokens

The circle, the dot and the gap come off --spacing, which is 4 pixels and holds still at every interface text setting. The label is the part that moves, since a type role is written in rem.

Colour by state ​

StateCircle borderCircle fillDot
Uncheckedline-defaultnonehidden
Unchecked, hoveredline-strongnonehidden
Checkedfill-primaryfill-primarysurface-page
Disabled, uncheckedline-defaultsurface-subtlehidden
Disabled, checkedline-defaultsurface-subtlefill-neutral

Hover keys on the pointer being over the circle, so crossing the label changes nothing even though clicking it selects the option. Hovering a checked circle changes nothing either, since the preset gates its hover rules on the option being unchecked. While disabled the circle takes a default cursor and the label keeps a pointer one. The label takes no colour class of its own and inherits fg-strong from the interface root, with opacity-disabled at 0.6 over it while disabled.

Measured contrast ​

Computed from the resolved token values rather than quoted from the accepted pairings file.

PairingLightDark
Checked circle against the page7.001.98
Dot against the checked circle7.001.98
Unchecked border against the page2.062.04
Hovered border against the page3.163.11
Disabled dot against surface-subtle3.433.49
Disabled border against surface-subtle1.911.90
Label against the page16.0812.45
Label at opacity-disabled, flattened4.435.45
Focus ring against the page10.728.90

What not to write ​

AvoidInstead
A class or a margin on the componentThe gap on the parent stack
A set whose options carry no shared nameThe same name on each of them
A value of a different type from the modelThe same type on both, checked by hand
Text between the tagsThe label prop
@click, or a form expecting an association@update:model-value, and a native input where a form association matters
Selection as the sole difference between two rowsA second signal beside the circle