Airframe GitHub Storybook
Component

ba-checkbox

A form field for single and multiple selections

Airframe

Active
Figma

Web Components

Active
Storybook Github

React

Active
Storybook Github

React Native

Planned
Design Code Accessibility QA
A

Checkbox input

The interactive control that allows users to select or unselect an option

B

Label

The text that clearly describes what the checkbox option means

C

Required indicator

Text to illustrate the checkbox is not required

This is when one, none, or multiple options can be selected. If only one option can be selected from a list of options, use ba-select or ba-radio-group instead.

  <ba-checkbox
    label="Checkbox label"
    name="checkboxName"
    value="checkboxValue"
    required
  ></ba-checkbox>
Property Attribute Description Type Default
checked checked If true, the checkbox is selected. boolean | undefined false
label(required) label text displayed next to the checkbox string undefined
name(required) name The name of the control, which is submitted with the form data. string undefined
required required If true, the user must check the checkbox before submitting a form. boolean | undefined false
value(required) value the value of the checkbox. string undefined
  • None
Slot Description Permitted elements
"error" Elements will render in the body of the component <p>

ba-checkbox can be slotted into:

Event Description Type
baChange Emitted when the checked property has changed. CustomEvent<CheckboxChangeEventDetail>
Method Description Type
isValid() => Promise<boolean> Triggers required validation and resolves with validity state. Promise<boolean>
reset() => Promise<void> Resets the checkbox back to its initial value and validity. Promise<void>
Basic example
<ba-checkbox
  label="Checkbox label"
  name="checkboxName"
  value="checkboxValue"
  required
></ba-checkbox>
Prop Description Type Default
checked If true, the checkbox is selected. boolean | undefined false
label (required) text displayed next to the checkbox string undefined
name (required) The name of the control, which is submitted with the form data. string undefined
required If true, the user must check the checkbox before submitting a form. boolean | undefined false
value (required) the value of the checkbox. string undefined
error Elements will render in the body of the component <p>

None

BaCheckbox can be slotted into:

Event handler Description
onBaChange Emitted when the checked property has changed.
Method Description Type
isValid() => boolean Triggers required validation and resolves with validity state. boolean
reset() => void Resets the checkbox back to its initial value and validity. void
Basic example
<BaCheckbox
  label="Checkbox label"
  name="checkboxName"
  value="checkboxValue"
  required
/>

React Native documentation coming soon.

Always use the label attribute to give a meaningful label to the field.

Further reading:

Disabled form elements are not supported in BAgel because they create accessibility challenges, such as preventing keyboard navigation, confusing screen reader users, and reducing visual clarity for those with impairments

Further reading:

State: Previous element in DOM has focus

⇥ Tab

<ba-checkbox> gets focus

State: <ba-checkbox> has focus

␣ Space

Toggles the checked state and emits baChange

⇥ Tab

Next tabbable element in the DOM gets focus

Use this checklist to confirm the component has been configured and used correctly.

  • Use ba-checkbox when one, none, or multiple options can be selected
  • Do not use ba-checkbox when only one option can be selected from a group; use ba-select or ba-radio-group instead
  • Label text is clear, concise, and helps users make an informed choice
  • A visible label is always provided
  • Disabled state is only used when interaction is intentionally unavailable
  • Checkbox is operable with keyboard using tab to focus and space to toggle
  • Focus indicator has not been obscured on all sides of the component

These checks are handled by the component and do not need to be repeated each time it is used.

  • ba-checkbox is operable using assistive technology
  • Has a visible focus indicator on all sides of the checkbox
  • Colour contrast for all states in all BAgel themes
  • Animations respect users' reduced motion settings
  • High contrast mode adjustments
Designing Developing Components BAgel helper QA process britishairways.com Careers Cookie policy