Skip to content

BbRadioGroup

Coordinates exclusive selection among radio options.

import { BbRadioGroup } from 'bitboss-ui';

On this page

Props

NameTypeDefaultDescription
autofocusBooleanish | undefined-

Sets autofocus on page load.

compactboolean | undefinedfalse

Sets the component in a compact state.

dependenciesunknown[] | undefined-

Defines an array of dependencies that will trigger actions in the component upon change.

depsDebounceTimenumber | undefined-

Timeout used to debounce response to changes to dependencies.

descriptionstring | undefined-

Descriptive text displayed below the label and above the input. Unlike the hint it is always visible, and it is linked to the input via aria-describedby (after any errors / warnings, before the hint).

The place to say why some options are locked. Arrow keys skip a non-selectable radio entirely, so a keyboard user never lands on one to find out.

See example
directionInputDirection | undefined-

Direction of the layout of the component. Can either be a predefined value or a pattern separated by a space like xx xxxxx.

disabledboolean | undefinedfalse

Disables the component.

Locks the group. Prefer readonly when the group already carries a selection: the per-option check currently exempts the selected option.

See example
enforceCoherenceboolean | undefinedfalse

If coherence is enforced the input cannot have a modelValue that is incoherent with its current items. e.g. You cannot set v-model to a user that is not present in the items passed. modelValue will be reset upon incoherence.

errorsstring | string[] | undefined-

Can be a string or an array of string containing the messages to display. They render in an aria-live="polite" region (announced when they appear) and, while the list is non-empty, are referenced FIRST from the control's aria-describedby, so the reason the field is invalid is re-read whenever the control regains focus.

The channel that produces the sentence the user reads. required marks the field; it does not write a message.

See example
hasErrorsboolean | undefinedfalse

Define if the component should be in an error state. It usually attaches a CSS class for styling purposes.

See example
hasWarningsboolean | undefinedfalse

Define if the component should be in a warning state. Same chrome as errors with --bb-warn; errors take priority.

hideLabelboolean | undefinedfalse

Visually hides each option's label text (the text rendered next to every input) while keeping it accessible to screen readers. Does not affect the fieldset legend — use hideLegend for that.

hideLegendboolean | undefinedfalse

Visually hides the legend of the fieldset while maintaining accessibility.

The right way to drop the legend visually. Removing it instead costs the group its role="radiogroup", which is only claimed when the set can be named.

See example
hintstring | undefined-

Text box to be displayed near the input, usually to indicate instructions.

idstring | undefined-

The identifier of the component.

inputDirection"horizontal" | "vertical" | undefined-

Defines the direction of the inputs in the fieldset.

Defaults to horizontal: a wrapping row, not a stack. The row is a plain flexbox and options are content-sized, so flex: 1 1 0 on the option is what makes tiles share the width evenly.

See example
inputPosition"left" | "center" | "right" | undefined"left"

Sets the alignment of the input. Since inputs are inline block they can be aligned just as text can.

itemPropsBbOptionGroupItemProps<T> | undefined-

ADDITIONAL row fields resolved from each item — never its text or value (those stay on itemText / itemValue). Option groups accept one field: - description — a muted line under the option label, beside the control; it may wrap. Either an object with a path or getter per field ({ description: 'email' }) or a function returning the fields ((item) => ({ description: item.email })). Without it no field renders — an item's own description is never read implicitly — and an empty value renders nothing for that item. The description is announced as the option's description, never part of its name. To disable individual options use selectable.

itemsrequiredT[] | ((prefill: boolean, modelValue?: any) => T[] | Promise<T[]>)-

Used to retrieve items; can be an array or a function.

Same mapping as every other options component. A radio group has no multiple and no max: one value is the whole contract.

See example
itemTextItemAccessor<T, string> | undefined-

Defines a path that returns a property of the object to use as text or a function that returns a string.

See example
itemValueItemAccessor<T> | undefined-

Defines a path that returns a property of the object to use as value or a function that returns any value.

See example
legendrequiredstring-

Text content of the legend.

Required, and load-bearing twice over here: it is the fieldset's accessible name and it is what lets the options container claim role="radiogroup", a role no native element supplies.

See example
legendMode"outside" | "inside" | undefined-

Legend rendering mode. 'outside' renders the legend above the fieldset in the normal flow; 'inside' overlays the legend inside the fieldset border. Floating mode is not supported for radio groups.

See example
legendPosition"left" | "center" | "right" | undefined-

Sets the text alignment of the label.

loadingTextstring | undefined-

String displayed while items are being loaded.

modelValuerequiredany-

Used by v-model. Can be any serializable type.

modelValueDebounceTimenumber | undefined-

Timeout used to debounce response to changes to modelValue.

namestring | undefined-

Defines the name of the option inputs. Optional: the options live inside a single component instance, so an omitted name falls back to a generated one that groups them correctly on its own — unique per group, so two groups never clear each other's selection, and stable for the group's lifetime. Pass a name only when the value has to be submitted under a known key by a native (non-JS) form post.

No longer required in v3. An omitted name falls back to a generated one, unique per group instance and stable for its lifetime, so two unnamed groups never clear each other. Pass one when the value has to post under a known key. A hand-composed set of BbRadio still needs an explicit shared name.

See example
noDataTextstring | undefined-

String displayed when there are no items to display.

persistentHintboolean | undefinedfalse

Keeps the hint displayed.

ptGroupPtMap<T> | undefined-

Passthrough, object form: the same keys as the pt:* attributes without the prefix. See the pt:<part> row.

pt:descriptionPtValue | undefined-
pt:description:disabledPtValue | undefined-
pt:description:errorsPtValue | undefined-
pt:description:has-valuePtValue | undefined-
pt:description:loadingPtValue | undefined-
pt:description:readonlyPtValue | undefined-
pt:description:warningsPtValue | undefined-
pt:hintPtValue | undefined-
pt:hint:disabledPtValue | undefined-
pt:hint:errorsPtValue | undefined-
pt:hint:has-valuePtValue | undefined-
pt:hint:loadingPtValue | undefined-
pt:hint:readonlyPtValue | undefined-
pt:hint:warningsPtValue | undefined-
pt:iconPtValue | ((ctx: PtItemCtx<T, GroupPtState>) => PtItemResult) | undefined-
pt:icon:checkedPtValue | undefined-
pt:icon:disabledPtValue | undefined-
pt:icon:errorsPtValue | undefined-
pt:icon:focus-visiblePtValue | undefined-
pt:icon:focusedPtValue | undefined-
pt:icon:has-valuePtValue | undefined-
pt:icon:loadingPtValue | undefined-
pt:icon:readonlyPtValue | undefined-
pt:icon:warningsPtValue | undefined-
pt:itemPtValue | ((ctx: PtItemCtx<T, GroupPtState>) => PtItemResult) | undefined-
pt:item-descriptionPtValue | ((ctx: PtItemCtx<T, GroupPtState>) => PtItemResult) | undefined-
pt:item-description:checkedPtValue | undefined-
pt:item-description:disabledPtValue | undefined-
pt:item-description:errorsPtValue | undefined-
pt:item-description:focus-visiblePtValue | undefined-
pt:item-description:focusedPtValue | undefined-
pt:item-description:has-valuePtValue | undefined-
pt:item-description:loadingPtValue | undefined-
pt:item-description:readonlyPtValue | undefined-
pt:item-description:warningsPtValue | undefined-
pt:item:checkedPtValue | undefined-
pt:item:disabledPtValue | undefined-
pt:item:errorsPtValue | undefined-
pt:item:focus-visiblePtValue | undefined-
pt:item:focusedPtValue | undefined-
pt:item:has-valuePtValue | undefined-
pt:item:loadingPtValue | undefined-
pt:item:readonlyPtValue | undefined-
pt:item:warningsPtValue | undefined-
pt:labelPtValue | ((ctx: PtItemCtx<T, GroupPtState>) => PtItemResult) | undefined-
pt:label:checkedPtValue | undefined-
pt:label:disabledPtValue | undefined-
pt:label:errorsPtValue | undefined-
pt:label:focus-visiblePtValue | undefined-
pt:label:focusedPtValue | undefined-
pt:label:has-valuePtValue | undefined-
pt:label:loadingPtValue | undefined-
pt:label:readonlyPtValue | undefined-
pt:label:warningsPtValue | undefined-
pt:legendPtValue | undefined-
pt:legend:disabledPtValue | undefined-
pt:legend:errorsPtValue | undefined-
pt:legend:has-valuePtValue | undefined-
pt:legend:loadingPtValue | undefined-
pt:legend:readonlyPtValue | undefined-
pt:legend:warningsPtValue | undefined-
pt:listPtValue | undefined-
pt:list:disabledPtValue | undefined-
pt:list:errorsPtValue | undefined-
pt:list:has-valuePtValue | undefined-
pt:list:loadingPtValue | undefined-
pt:list:readonlyPtValue | undefined-
pt:list:warningsPtValue | undefined-
pt:messagePtValue | undefined-
pt:message:disabledPtValue | undefined-
pt:message:errorsPtValue | undefined-
pt:message:has-valuePtValue | undefined-
pt:message:loadingPtValue | undefined-
pt:message:readonlyPtValue | undefined-
pt:message:warningsPtValue | undefined-
pt:rootPtValue | undefined-
pt:root:disabledPtValue | undefined-
pt:root:errorsPtValue | undefined-
pt:root:has-valuePtValue | undefined-
pt:root:loadingPtValue | undefined-
pt:root:readonlyPtValue | undefined-
pt:root:warningsPtValue | undefined-
readonlyboolean | undefinedfalse

Sets the input in a readonly state.

The radio role supports no aria-readonly, so the state can only be announced on the group — which is something this component has and a hand-composed set of BbRadio does not.

See example
requiredboolean | undefinedfalse

Sets the input as required.

The only one of the three groups with this prop, because one value is either present or absent. It marks the field for assistive technology and raises the asterisk; the message still comes from errors.

See example
reverseboolean | undefinedfalse

Reverses the layout. Applicable in every direction the order of the label and the input is swapped.

selectableboolean | ((item: T) => boolean) | undefinedtrue

Defines whether options are selectable. Can be a global boolean that affects all options or a function that accepts an item and returns a boolean that only affects that item. Non-selectable options are rendered disabled.

A rejected option is skipped by the arrow keys, not merely greyed, so the reason has to be written somewhere the user will read. Also where v2's per-item disabled field went — that field is inert in v3, silently.

See example
warningsstring | string[] | undefined-

Warning messages to display beneath the field, in their own aria-live region and amber (--bb-text-warn). A string or array; a non-empty list implies the warning state. Errors suppress warnings when both are set. While displayed they are also referenced from the control's aria-describedby, after any errors and before the description/hint.

v-model

Values kept in sync through v-model.

NameTypeDescription
modelValueany

One resolved value, never an array — seed it null for "nothing chosen". Nothing the user can do puts it back to null, so if the empty state stays legitimate, give it an option of its own.

See example

Events

NameTypeDescription
active(e: "active"): void

Emitted when the group becomes active (focus/click enters it).

blur(e: "blur", event: FocusEvent): void

Emitted when one of the generated radio inputs loses focus. Forwards the original DOM FocusEvent.

change(e: "change", event: Event): void

Emitted when a radio option is selected. Forwards the original DOM Event from the radio input.

click(e: "click", event: MouseEvent): void

Emitted when one of the generated radio inputs is clicked. Forwards the original DOM MouseEvent.

focus(e: "focus", event: FocusEvent): void

Emitted when one of the generated radio inputs receives focus. Forwards the original DOM FocusEvent.

inactive(e: "inactive"): void

Emitted when focus/click moves outside the group after it was active. Useful for validation-on-blur flows at group level.

input(e: "input", event: Event): void

Emitted on native input events from generated radio inputs. Forwards the original DOM Event.

keydown(e: "keydown", event: KeyboardEvent): void

Emitted for keyboard interaction on generated radio inputs. Forwards the original DOM KeyboardEvent.

mousedown(e: "mousedown", event: MouseEvent): void

Emitted when a pointing device button is pressed over a radio input. Forwards the original DOM MouseEvent.

mouseup(e: "mouseup", event: MouseEvent): void

Emitted when a pointing device button is released over a radio input. Forwards the original DOM MouseEvent.

update:modelValue(e: "update:modelValue", value: any): void

Emitted with the newly selected value when the selection changes.

Slots

The listed properties are the ones exposed to the slot scope.

NameTypeDescription
appendobject

Content rendered after the last option, inside the options container.

descriptionBbRadioGroupDescriptionSlotProps

Replaces the description text. Provided alone (no description prop) it still renders the description region and wires it into aria-describedby.

iconBbRadioGroupIconSlotProps<T>

Replaces the default radio dot icon for each option. Receives the radio state plus the source item and its display text.

Replaces the dot per option and receives item alongside the live state, which is how a tile is built from your own data. Everything underneath stays a native radio, so exclusivity and the arrow keys are untouched.

See example
labelBbRadioGroupLabelSlotProps<T>

Replaces the default label text for each option.

Scoped { item, text, checked }, one template for every option. It is what replaced v2's removed #option:prepend and #option:append.

See example
legendBbRadioGroupLegendSlotProps

Replaces the default fieldset legend text for the group.

loadingobject

Content shown while options are loading (replaces the default loading text).

no-dataobject

Content shown when no options are available (replaces the default "no data" text).

prependobject

Content rendered before the first option, inside the options container.

Changes from v2

Props removed or renamed in 3.0. If you are coming from v2, the answer is here.

  • colorremovedfails silently
  • hasWarninghasWarningsfails silently
  • labelPositionlegendPositionfails silently