Airframe GitHub Storybook
Component

ba-filter

A wrapper component for displaying a filter

Airframe

Active
Figma

Web Components

Active
GitHub

React

Planned

React Native

Planned

Must be used with ba-toolbar

This component should not be used on its own. Always use it within ba-toolbar to ensure correct spacing and layout

ba-toolbar
Design Code Accessibility QA
A

Filter toggle

The interactive button that displays the filter's label, a count of any selected options, and a chevron icon, and opens or closes the dropdown panel

B

Dropdown panel

The panel that reveals the filter's options, such as ba-filter-checkbox or ba-filter-radio, when the toggle is activated

A ba-filter should only contain one type of filter option at a time. Use ba-filter-checkbox when more than one option can be selected, or ba-filter-radio when only one option can be selected from the group.

The label attribute should describe what the filter options relate to, for example "Outbound airport" or "Stops", so users can quickly scan and find the filter they need.

<ba-toolbar>
  <ba-filter label="Outbound airport" slot="filters">
    <ba-filter-checkbox name="londonHeathrow" label="London Heathrow (LHR)" value="1"></ba-filter-checkbox>
    <ba-filter-checkbox name="londonGatwick" label="London Gatwick (LGW)" value="2"></ba-filter-checkbox>
  </ba-filter>
</ba-toolbar>
Property Attribute Description Type Default
label(required) label The label of the filter string undefined
value value Concatenated value of all selected filters string | undefined ''
  • None
Slot Description Permitted elements
Unnamed slot Elements will render in the body of the component <ba‑filter‑checkbox>, <ba‑filter‑radio>

ba-filter can be slotted into:

Method Description Type
removeSelectedFilters(filterName: string) => Promise<void> Removes the selected filters. Promise<void>
reset() => Promise<void> Resets all the filters in the filter. Promise<void>
setSelectedFilter(filterName: string, filterValue: string, filterLabel: string) => Promise<void> Sets the selected filters. Promise<void>
setSelectedRadioFilter(filterName: string, filterValue: string, filterLabel: string, emit?: boolean) => Promise<void> Sets the selected radio filter. Promise<void>

ba-filter should always be used within ba-toolbar to ensure correct spacing and layout.

Add ba-filter-checkbox children to allow more than one option to be selected.

A filter with two checkbox options, wrapped in ba-toolbar
<ba-toolbar>
  <ba-filter label="Outbound airport" slot="filters">
    <ba-filter-checkbox name="londonHeathrow" label="London Heathrow (LHR)" value="1"></ba-filter-checkbox>
    <ba-filter-checkbox name="londonGatwick" label="London Gatwick (LGW)" value="2"></ba-filter-checkbox>
  </ba-filter>
</ba-toolbar>

React documentation coming soon.

React Native documentation coming soon.

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

Further reading:

State: Previous element in DOM has focus

⇥ Tab

<button> in shadow DOM (the filter toggle) gets focus

State: <button> in shadow DOM (the filter toggle) has focus

⏎ Enter

Opens the dropdown panel

␣ Space

Opens the dropdown panel

State: <button> in shadow DOM (the filter toggle) has focus and the dropdown panel is closed

⇥ Tab

Next tabbable element outside of the filter gets focus

State: <button> in shadow DOM (the filter toggle) has focus and the dropdown panel is open

⇥ Tab

First tabbable element inside the dropdown panel gets focus

State: Last tabbable element inside the open dropdown panel has focus

⇥ Tab

Next tabbable element outside of the filter gets focus

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

  • ba-filter is always used within ba-toolbar to ensure correct spacing and layout on both mobile and desktop
  • ba-filter is not used on its own outside of ba-toolbar
  • Contains either ba-filter-checkbox children, when more than one option can be selected, or ba-filter-radio children, when only one option can be selected, not a mix of both
  • Label clearly identifies what the filter options relate to, for example "Outbound airport"
  • A visible label is always provided using the label attribute
  • ba-filter is operable with keyboard using tab to focus, and enter or space to open the dropdown
  • 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-filter is operable using assistive technology
  • Open and closed states are available to assistive technology via aria-expanded
  • Has a visible focus indicator on all sides of the component
  • 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