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 just 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 four statuses.
- Notice
Use to convey a general, neutral, and non-urgent 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 notice 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 notice 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 notice chips, the icon can be customized.
Developer notes
Custom icons can only be used with the notice
status. If they are passed with a different status, they will be ignored.
Statuses
Use the status
prop to create warning, error, and success InfoChips.
Technical implementation
Vue usage
Props
Prop name | Description | Type | Values | Default |
---|---|---|---|---|
status | Status type. | StatusType | 'notice' , '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 four status types, "notice", "warning", "error", and "success".
Apply the following classes to the root element to define the status styles:
- Notice:
cdx-info-chip--notice
(class can be omitted since this is the default) - 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 "notice" status, 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 "notice" status InfoChips.