Checkbox group
A labeled set of related checkboxes.
Example
<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>import { CheckboxGroup } from '@focsd-dev/react';
export function Example() { return <CheckboxGroup label="Email me about" hint="Choose any.">…</CheckboxGroup>;}<script setup>import '@focsd-dev/components/focsd-checkbox-group.js';</script>
<template> <focsd-checkbox-group label="Email me about" hint="Choose any.">…</focsd-checkbox-group></template>// Add CUSTOM_ELEMENTS_SCHEMA to the component's schemas, then:import '@focsd-dev/components/focsd-checkbox-group.js';
// template<focsd-checkbox-group label="Email me about" hint="Choose any.">…</focsd-checkbox-group><script> import '@focsd-dev/components/focsd-checkbox-group.js';</script>
<focsd-checkbox-group label="Email me about" hint="Choose any.">…</focsd-checkbox-group>API
Attributes
| Attribute | Property | Type | Default |
|---|---|---|---|
label | label | string | — |
hint | hint | string | — |
error | error | string | undefined | — |
disabled | disabled | boolean | false |
name | name | string | — |
Slots
| Slot | Description |
|---|---|
(default) | Default content. |
CSS parts
Style the inside of the component with ::part(), for example focsd-checkbox-group::part(error).
| Part | Description |
|---|---|
error | The error element. |
fieldset | The fieldset element. |
hint | The hint element. |
items | The container around the slotted controls. |
legend | The 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.
Ask the docs
Hi, what are you building?
Ask about any component, theming, forms or frameworks. I answer with the right component, a snippet and a link to its docs.