Allows users to make selections, filter content, or trigger actions
Chips are compact elements that represent a selection, attribute, or dynamic action.
Use chips to directly specify, dynamically categorize or immediately perform a discrete action.
Use icon-left
or icon-right
slots to pass icons into a chip. Place the X remove icon in the icon-right slot only. Place other icons in the icon-left slot. Use only one icon per chip.
Use stateful chips to update settings immediately or trigger an immediate action while staying on the same page.
For chips that toggle a single selection on and off, use the click event and dynamic properties in order to change the label or state of a chip. The aria-pressed
attribute should be used to designate the state of the toggle.
Filter chips add a visual representation of user selected filters. Filter chips that represent user selections that can be dynamically removed should include an X icon in the right icon slot and be linked to the ID of the input it controls using aria-controls
. The aria-pressed
property should be set to true to designate that this selection is active. Filter chips that are linked to a checkbox should appear selected and be included in the same form group as the checkboxes.
Use selection chips to allow users to make a single select choice or a multiple select choice. Single select chip groups are a more prominent alternative to radio buttons while multiple select chip groups are a more prominent alternative to checkboxes.
For single select chip groups, apply role='radio'
to each chip and role='radiogroup'
to the group. Use aria-checked="true"
and tabindex="0"
to designate the selected chip, and apply aria-checked="false"
and tabindex="-1"
to the other chips. The chip elements should be grouped directly inside a CdrChipGroup element to ensure keyboard navigation is properly managed. The CdrChipGroup element requires a label property or slot be passed in which describes the chip group. This label is visually hidden by default.
For multiple select chip groups, apply role='checkbox'
to each chip, use aria-checked="true"
to designate the selected chip, and apply aria-checked="false"
to the other chips. The chip elements should be grouped directly inside a CdrChipGroup element to ensure keyboard navigation is properly managed. The CdrChipGroup element requires a label property or slot be passed in which describes the chip group. This label is visually hidden by default.
Many WCAG requirements are contextual to their implementation. To ensure that usage of this component complies with accessibility guidelines:
role="radio"
, aria-checked
, and tabindex
on each chip and wrap the group in a CdrChipGroup component. The selected chip should have aria-checked="true"
and tabindex="0"
set, while the rest of the chips should have aria-checked="false"
and tabindex="-1"
.aria-controls
on the chip to point to the ID of the input being modifiedrole="switch"
and aria-checked
to designate its state.CdrChip and CdrChipGroup implement the following accessibility requirements:
Chips allow users to make selections, filter content, or trigger actions. While buttons are expected to appear consistently and with familiar calls to action, chips should appear dynamically.
One chip container style is available: pill.
When arranging chips horizontally:
When stacking chips vertically:
When using chips in a group:
Chip text should:
Stateful chips used to dynamically perform a discrete action:
Chips used for single selection:
Chips used for multiple selection:
Filter chips:
When making decisions about whether to use a button, links or chips, consider the following:
Buttons | Links | Chips |
---|---|---|
Toggling a display to full screen | Navigating user to a new page or view | Representing a filtered list of content that appear on the same page |
Opening a modal window | Changing the URL | Offering a choice or representing a filter |
Triggering a popup menu | Causing a browser redraw or refresh | Immediately changing a setting on the page |
Find more information about using Slots in the article Installing Cedar.
default
name
Slot for CdrChip content.
label
name
string
type
'default'
default
Sets a label that describes the chip group and what it is selecting. By default this label is visually hidden and only made available to screen readers.
hide-label
name
boolean
type
'true'
default
Visually hides the chip group label but makes it accessible to screen readers.
Find more information about using Slots in the article Installing Cedar.
label
name
Slot for overriding CdrChip label content with a custom element.