Checkbox Group

Groups related checkboxes under one label, lays them out, propagates a shared size / disabled, and reports the checked values.

Basic

React Angular Vue Svelte
group.html
html
1 <nana-checkbox-group label="Frameworks">
2 <nana-checkbox value="react" checked>React</nana-checkbox>
3 <nana-checkbox value="angular" checked>Angular</nana-checkbox>
4 <nana-checkbox value="vue">Vue</nana-checkbox>
5 </nana-checkbox-group>

Horizontal

Cheese Mushroom Olives

Required & error

React Vue

Reading the value

wire-up.ts
ts
1 const group = document.querySelector('nana-checkbox-group');
2 group.addEventListener('nana-change', (e) => {
3 console.log(e.detail.value); // ["react", "angular"]
4 });

Import

main.ts
ts
1 import "@nana-tec/ui-components/checkbox-group";
2 import "@nana-tec/ui-components/checkbox";

Props

AttributeTypeDefaultDescription
labelstringGroup label
orientationhorizontal | verticalverticalLayout direction
sizesm | md | lgApplied to every child checkbox
disabledbooleanfalseDisable every child
requiredbooleanfalseVisual asterisk on the legend
errorstringError message beneath the group