Skip to content
Focsd homeFocsd homeFocsd
Forms

Checkbox group

A labeled set of related checkboxes.

  • Tag: focsd-checkbox-group
  • Pattern: Group + fieldset
  • Category: Forms

Example

Product releases Security notices Events (unavailable)
HTML
<focsd-checkbox-group label="Email me about" hint="Choose any.">
<focsd-checkbox name="topics" value="releases" checked>Product releases</focsd-checkbox>
<focsd-checkbox name="topics" value="security">Security notices</focsd-checkbox>
<focsd-checkbox name="topics" value="events" disabled
>Events (unavailable)</focsd-checkbox
>
</focsd-checkbox-group>

Usage

Import the module once, then use the tag like any HTML element. Every framework below renders the same element; see Frameworks for setup.

<script type="module">
import '@focsd-dev/components/focsd-checkbox-group.js';
</script>
<focsd-checkbox-group label="Email me about" hint="Choose any.">…</focsd-checkbox-group>

API

Attributes

AttributePropertyTypeDefault
labellabelstring—
hinthintstring—
errorerrorstring | undefined—
disableddisabledbooleanfalse
namenamestring—

Slots

SlotDescription
(default)Default content.

CSS parts

Style the inside of the component with ::part(), for example focsd-checkbox-group::part(error).

PartDescription
errorThe error element.
fieldsetThe fieldset element.
hintThe hint element.
itemsThe container around the slotted controls.
legendThe legend element.

Accessibility

  • A shadow <fieldset> and <legend> give the checkboxes a group name; the hint and error render inside it.
  • Each checkbox submits on its own.