# Checkbox Checkbox present a list of options where users can make multiple selections, a single selection or none at all. They support user interaction by allowing the selection of independent items ensuring that users can easily customize settings, filter search results and submit multi choice forms with clarity. **Category:** Components **Storybook:** https://doc.ux4g.gov.in/web/?path=/story/ux4g-components-checkbox--introduction ## Framework setup ### HTML / CDN ```html ``` ### React ```bash npm install ux4g-web-components ``` ```jsx import 'ux4g-web-components/styles.css'; import 'ux4g-web-components/design-system'; ``` ### Angular Update `angular.json`: ```json { "styles": [ "node_modules/ux4g-web-components/styles/ux4g.css", "src/styles.css" ], "scripts": [ "node_modules/ux4g-web-components/dist/runtime/design-system.js" ] } ``` ## Code examples The snippets below are extracted from the Storybook canvas for Checkbox. Each example shows the rendered HTML, the equivalent React JSX, and the Angular template markup. ### 1. Checkbox Group — Checkbox Group HTML: ```html Email notifications, Push notifications ``` React: ```jsx import React from 'react'; const CheckboxExample1Demo = () => ( <> {/* Group Item: Email notifications */} {/* Group Item: SMS notifications */} {/* Group Item: Push notifications */} {/* defaultSelected Summary Target */} Email notifications, Push notifications > ); export default CheckboxExample1Demo; ``` Angular: ```html Email notifications, Push notifications ``` ### 2. Checked States — Checked States HTML: ```html ``` React: ```jsx import React from 'react'; const CheckboxExample2Demo = () => ( <> {/* State: Unchecked */} {/* State: defaultChecked */} {/* State: Indeterminate (data-ux4g-indeterminate sets indeterminate on init) */} > ); export default CheckboxExample2Demo; ``` Angular: ```html ``` ### 3. Description Variants — Description Variants (Propagation) HTML: ```html ``` React: ```jsx import React from 'react'; const CheckboxExample3Demo = () => ( <> {/* Description: Info */} {/* Description: Error */} {/* Description: Warning */} {/* Description: Success */} > ); export default CheckboxExample3Demo; ``` Angular: ```html ``` ### 4. Introduction — Introduction HTML: ```html
Checkbox present a list of options where users can make multiple selections, a single selection or none at all. They support user interaction by allowing the selection of independent items ensuring that users can easily customize settings, filter search results and submit multi choice forms with clarity.
A compact tour of the checkbox patterns used across the source-backed stories.
Quickly copy the checkbox classes used by the showcased source-backed variants.
| Purpose | Class |
|---|---|
| Base |
ux4g-checkbox
|
| Input |
ux4g-checkbox-input
|
| Control |
ux4g-checkbox-control
|
| Mark |
ux4g-checkmark
|
| Content |
ux4g-checkbox-content
|
| Header |
ux4g-checkbox-header
|
| Label |
ux4g-checkbox-label
|
| Description |
ux4g-checkbox-description
|
| Required |
ux4g-checkbox-required
|
| Icon |
ux4g-checkbox-icon
|
| Helper |
ux4g-checkbox-desc-helper
|
| Error |
ux4g-checkbox-desc-error
|
| Warning |
ux4g-checkbox-desc-warning
|
| Success |
ux4g-checkbox-desc-success
|
| State |
ux4g-checkbox-error
|
Checkbox present a list of options where users can make multiple selections, a single selection or none at all. They support user interaction by allowing the selection of independent items ensuring that users can easily customize settings, filter search results and submit multi choice forms with clarity.
A compact tour of the checkbox patterns used across the source-backed stories.
Quickly copy the checkbox classes used by the showcased source-backed variants.
| Purpose | Class |
|---|---|
| Base |
ux4g-checkbox
|
| Input |
ux4g-checkbox-input
|
| Control |
ux4g-checkbox-control
|
| Mark |
ux4g-checkmark
|
| Content |
ux4g-checkbox-content
|
| Header |
ux4g-checkbox-header
|
| Label |
ux4g-checkbox-label
|
| Description |
ux4g-checkbox-description
|
| Required |
ux4g-checkbox-required
|
| Icon |
ux4g-checkbox-icon
|
| Helper |
ux4g-checkbox-desc-helper
|
| Error |
ux4g-checkbox-desc-error
|
| Warning |
ux4g-checkbox-desc-warning
|
| Success |
ux4g-checkbox-desc-success
|
| State |
ux4g-checkbox-error
|
Checkbox present a list of options where users can make multiple selections, a single selection or none at all. They support user interaction by allowing the selection of independent items ensuring that users can easily customize settings, filter search results and submit multi choice forms with clarity.
A compact tour of the checkbox patterns used across the source-backed stories.
Quickly copy the checkbox classes used by the showcased source-backed variants.
| Purpose | Class |
|---|---|
| Base |
ux4g-checkbox
|
| Input |
ux4g-checkbox-input
|
| Control |
ux4g-checkbox-control
|
| Mark |
ux4g-checkmark
|
| Content |
ux4g-checkbox-content
|
| Header |
ux4g-checkbox-header
|
| Label |
ux4g-checkbox-label
|
| Description |
ux4g-checkbox-description
|
| Required |
ux4g-checkbox-required
|
| Icon |
ux4g-checkbox-icon
|
| Helper |
ux4g-checkbox-desc-helper
|
| Error |
ux4g-checkbox-desc-error
|
| Warning |
ux4g-checkbox-desc-warning
|
| Success |
ux4g-checkbox-desc-success
|
| State |
ux4g-checkbox-error
|