Skip to content

BbCheckboxGroup

Manages multiple checkbox options as a group.

import { BbCheckboxGroup } from 'bitboss-ui';

On this page

Props

NameTypeDefaultDescription
autofocusBooleanish | undefined-

Sets autofocus on page load.

compactboolean | undefinedfalse

Displays the component in a compact version.

See example
dependenciesunknown[] | undefined-

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

Only meaningful when items is a provider function: it names what makes the group call it again. A dependency that is a text field wants deps-debounce-time with it; one that is another group does not.

See example
depsDebounceTimenumber | undefined-

Timeout used to debounce response to changes to dependencies.

See example
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).

One description for the whole set — there is no per-option equivalent. When each option needs its own line, the options are not uniform and a BbCheckbox per row is the honest answer.

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.

Splits the legend from the options, not the options from each other — that is input-direction. Defaults to vertical, which is why the legend sits above.

See example
disabledboolean | undefinedfalse

Disables the component.

Currently exempts options that are already ticked, so a disabled group with a selection can still be unticked. Until that is fixed in the library, lock a group carrying a selection with readonly.

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.

Drops model entries the current options no longer contain. Worth it when the options depend on another field, and not otherwise — a selection can vanish without the user doing anything.

See example
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.

One channel for the whole fieldset, which is the concrete payoff over a hand-stacked row of BbCheckbox — there, the message has to be pinned to one arbitrary box.

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.

See example
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.

Hides each option's text, not the legend. For a group whose options are drawn entirely by the icon slot, and nothing else.

See example
hideLegendboolean | undefinedfalse

Visually hides the legend of the fieldset while maintaining accessibility.

Hides the group's name while keeping it for assistive technology. For when a visible heading right above already says the same words — never as a way to avoid writing one.

See example
hintstring | undefined-

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

See example
idstring | undefined-

The identifier of the component.

inputDirection"horizontal" | "vertical" | undefined-

Defines the direction of the inputs in the fieldset.

Lays the options out inside the fieldset. Defaults to horizontal: a wrapping row, not a stack.

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.

See example
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.

An array, or a function called on mount and after every dependencies change, returning an array or a promise. Options whose resolved value duplicates an earlier one are dropped silently, first occurrence winning.

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.

A property path ("fullName", "profile.city") or a function. Omit it for primitive items, where the value is its own label.

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.

Prefer a stable primitive id. With this unset the model holds the whole item, which works — matching is structural, not by reference — but an id survives a refetch and is readable in a payload.

See example
legendrequiredstring-

Text content of the legend.

Required, because it is the fieldset's accessible name: a screen reader announces it on entry, so every box is heard as an answer to a named question. Hide it with hide-legend when a visible heading already carries it.

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 option groups (checkbox, radio or switch) — there is no single field for the legend to float against.

No floating mode here — a group has no single input for a label to float into.

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

Sets the text alignment of the label.

Renamed from v2's labelPosition, with no change in behaviour. The rename is silent: an unknown attribute falls through to the DOM, so the alignment just stops applying.

See example
loadingTextstring | undefined-

String displayed while items are being loaded.

Worth setting to something specific. "Loading hubs…" tells the reader more than the default.

See example
maxnumber | undefined-

Maximum number of selected items.

A shape rule, not a validation rule: it prevents the extra choice rather than complaining about it. Once the cap is reached the options that are off render disabled and the ticked ones stay live, so the user swaps rather than getting stuck.

See example
modelValuerequiredany-

Used by v-model. Can be an array of any serializable type.

modelValueDebounceTimenumber | undefined-

Timeout used to debounce response to changes to modelValue.

multipleboolean | undefinedtrue

Enables multi-selection behavior. When true, modelValue must be an array. When false, modelValue should be a single value.

True by default, so the model must be an array — a non-array throws on mount. Setting it false gives a single-value control that emits a bare value and null; it works, and an exclusive choice drawn as checkboxes is BbRadioGroup.

See example
namestring | undefined-

Defines the name of the input.

noDataTextstring | undefined-

String displayed when there are no items to display.

See example
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.

Keeps every box focusable and submitted while swallowing every change. The right lock for a value the user may read and must not alter, and the reliable one when the group already carries a selection.

See example
reverseboolean | undefinedfalse

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

See example
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 boolean for the group or a predicate over the item. This is where v2's per-item disabled field went: that field is inert in v3, silently, so options that used to render locked become tickable.

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.

See example

v-model

Values kept in sync through v-model.

NameTypeDescription
modelValueany

The array of resolved values, re-emitted in full on every change — never the option that moved. Diff it against the previous value when you need to know what changed.

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 checkbox inputs loses focus. Forwards the original DOM FocusEvent.

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

Emitted when an option is toggled. Forwards the original DOM Event from the checkbox input.

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

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

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

Emitted when one of the generated checkbox 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 checkbox inputs. Forwards the original DOM Event.

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

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

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

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

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

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

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

Emitted with the coherent next selection array whenever 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.

descriptionBbCheckboxGroupDescriptionSlotProps

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

iconBbCheckboxGroupIconSlotProps<T>

Replaces the default checkmark icon for each checkbox option.

Replaces the box visual per option, and receives item and text alongside the live state.

See example
labelBbCheckboxGroupLabelSlotProps<T>

Replaces the default label text for each option.

One template for every option, scoped { item, text, checked }. Decorate text rather than dropping it — what renders here is the option's accessible name. This is what replaced v2's removed #option:prepend and #option:append.

See example
legendBbCheckboxGroupLegendSlotProps

Replaces the default fieldset legend text for the group.

Scoped { text, hasErrors, hasWarnings }, plus showAsterisk on the validated import.

See example
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