{{#extend "layout-docs"}} {{#replace "pageTitle"}}Checkbox{{/replace}} {{#replace "main"}}

Checkbox

Introduction

The custom checkbox we use must be wrapped in a input-checkbox element.

The data-js=input-checkbox has been deprecated and will be removed in v2.0, in favour of the pure CSS implementation.

Note: there is now a CSS-only, Non-JS implementation of this component. Please refer to the UIF Storybook documentation for more information.

{{#each checkbox-input}}

{{description}}

{{> input-checkbox}}
{{> input-checkbox-src}}
{{/each}}

Usage

Class name Effect Remarks
.input-checkbox Placed on a wrapper around the checkbox input and label. Adds custom styling to the checkbox and label as per the UIF Required.
[data-js="input-checkbox"] Placed on the input-checkbox element. In the event that the input and label aren't direct siblings, this JS hook will handle whether a checkbox is checked or not. Required if input and label are not direct siblings.
Deprecated — will be removed in v2.0
.input-checkbox--hiddenlabel Placed on the input-checkbox element. Will visually hide the text of the label. The text will still be readable by screenreaders. Optional
{{/replace}} {{/extend}}