UNPKG

@lion/ui

Version:

A package of extendable web components

52 lines (40 loc) 1.71 kB
--- parts: - Checkbox Group - Overview title: 'Checkbox Group: Overview' eleventyNavigation: key: 'Checkbox Group: Overview' order: 10 parent: Checkbox Group title: Overview --- # Checkbox Group: Overview A checkbox group enhances the functionality of the native `<input type="checkbox">` element. Its purpose is to provide a way for users to check **multiple** options amongst a set of choices, or to function as a single toggle. > You should use our `checkbox` elements as children in checkbox group. ```js script import { html } from '@mdjs/mdjs-preview'; import '@lion/ui/define/lion-checkbox-group.js'; import '@lion/ui/define/lion-checkbox.js'; ``` ```html preview-story <lion-checkbox-group name="scientists[]" label="Favorite scientists"> <lion-checkbox label="Archimedes" .choiceValue="${'Archimedes'}"></lion-checkbox> <lion-checkbox label="Francis Bacon" .choiceValue="${'Francis Bacon'}"></lion-checkbox> <lion-checkbox label="Marie Curie" .choiceValue="${'Marie Curie'}"></lion-checkbox> </lion-checkbox-group> ``` > Make sure that the checkbox-group also has a name attribute, this is necessary for our [form](https://github.com/ing-bank/lion/blob/5f1d7166273cc724458c0239822cd454e16253fa/docs/components/form/overview.md)'s serialization result. ## Features Since it extends from our [fieldset](https://github.com/ing-bank/lion/blob/5f1d7166273cc724458c0239822cd454e16253fa/docs/components/fieldset/overview.md), it has all the features a fieldset has. ## Installation ```bash npm i --save @lion/ui ``` ```js import '@lion/ui/define/lion-checkbox-group.js'; import '@lion/ui/define/lion-checkbox-indeterminate.js'; import '@lion/ui/define/lion-checkbox.js'; ```