InfoChip ​
An InfoChip is a non-interactive indicator that provides information and/or conveys a status.
| Name | Value |
|---|---|
| Props | |
icon | |
status | |
| Slots | |
default | |
| View | |
Reading direction | |
Note: For icon properties, the relevant icon also needs to be imported from the @wikimedia/codex-icons package. See the usage documentation for more information. | |
Overview ​
When to use InfoChip ​
Use the InfoChip component to label, categorize, or organize information using keywords. This type of chip is informative so it cannot be clickable or removable.
Depending on the type of feedback conveyed to the user, InfoChips can be used to convey one of six statuses.
- Subtle
Use for subtle information that does not need to convey "status" or the need for additional visible attention — the most basic version of a small pill of information. - Notice
Use to convey a general and non-urgent status. Think of this as a neutral version of warning, error, or success. - Progressive
Use to convey a progressive status that draws extra attention but does not communicate cautionary, negative, or positive status. - Warning
Use to convey a cautionary status. - Error
Use to convey a negative status. - Success
Use to convey a positive status.
About InfoChip ​
InfoChip includes the following elements.
Icon (optional) ​
For subtle, notice, and progressive chips, the icon is optional and customizable, while for chips providing feedback (warning, error, and success), the icon is required to communicate the feedback status effectively.
- Use a start icon in subtle, notice, and progressive chips when needed to strengthen the text, or hide it if not required.
- Avoid removing or replacing the icon in warning, error, and success chips, as it reinforces the meaning of their respective statuses.
Label ​
Descriptive text about the chip.
Use short text with the InfoChip. Long text content will be truncated with an ellipsis and lines will not be wrapped.
Examples ​
With icon ​
For subtle, notice, and progressive chips, the icon can be customized.
Developer notes
Custom icons can only be used with the sublte, notice, and progressive statuses. If they are passed with a different status, they will be ignored.
Statuses ​
Use the status prop to create subtle, progressive, warning, error, and success InfoChips.
Technical implementation ​
Vue usage ​
Props ​
| Prop name | Description | Type | Values | Default |
|---|---|---|---|---|
status | Status type. | StatusType | 'subtle', 'notice', 'progressive', 'warning', 'error', 'success' | 'notice' |
icon | Custom icon to use for "notice" chips. Chips with other status types (warning, etc) do not allow custom icons and will ignore this option. | Icon | - | null |
Slots ​
| Name | Description | Bindings |
|---|---|---|
| default | Chip content. |
CSS-only version ​
Markup structure ​
Text only ​
A simple chip with text content and no icon is straightforward.
Status types ​
There are size status types, "subtle", "notice", "progressive", "warning", "error", and "success".
Apply the following classes to the root element to define the status styles:
- Subtle:
cdx-info-chip--subtle - Notice:
cdx-info-chip--notice(class can be omitted since this is the default) - Progressive:
cdx-info-chip--progressive - Warning:
cdx-info-chip--warning - Error:
cdx-info-chip--error - Success:
cdx-info-chip--success
Status icons ​
Each status has a corresponding default icon (cdxIconInfoFilled for "subtle", "notice", and "progressive" statuses, cdxIconAlert for "warning" status, cdxIconError for "error" status, and cdxIconSuccess for "success" status). Examples of the default icons can be found below.
To use the default icon for a given chip status, simply include an empty <span> element with the class cdx-info-chip__icon inside the chip element.
Custom icons ​
You can customize the icon by using the CSS-only Icon Less mixin (.cdx-mixin-css-icon) to apply the icon styles, passing the appropriate parameters to the mixin.
Custom icons should only be used with "subtle", "notice", and "progressive" status InfoChips.