--- title: "Badge" slug: badge category: component type: documentation version: 20.0.0 tokens: 2460 source: https://ovh.github.io/design-system/v20.0.0/llms/react-components-badge--documentation.txt --- # Badge _**Badge** show concise metadata or the current status for an item, in a compact format._ ## Overview A **Badge** component labels an item, a keyword or a status. They are non-interactive and used inline, next to the title or text they complete. | | | |---|---| | Name | Badge | | Also known as | Chip (previous name), Label | | Design | https://www.figma.com/design/9jDDTcR4a9jPRFcdjawAlf/ODS---UI-Kit?node-id=3-22285 | | Source | https://github.com/ovh/design-system/tree/master/packages/ods-react/src/components/badge | ## Usage Badges are used for items that need to be labelled or categorized. It can refer to these examples of enhanced data : * A notification status * A marketing category * Additional product information ### Notification Status The notification status can be used next to a menu entry, a label or an option ; in dashboards, Table or summary panels. There are four different sub-types of status, in order of severity: * **Error** : Reserved for errors, malfunctions, as well as critical issues. System is unusable, or an action must be taken immediately. * **Warning** : Reserved for critical messages that need the user attention and acknowledgment, but might not cause errors. * **Information** : Provides information to users in context. Shouldn't replace regular content. * **Success** : Reserved to provide to a static persistent success message. ### Marketing category The marketing category is used in product Tiles or product descriptions; used as - temporary or permanent - marketing highlight. It can contain categories like _"Promotion", "Summer Deals", "Black Friday", "Limited Edition", "Flash Sales"_, ... ### Additional product information The product status is used in product Tiles or product descriptions, it is bound inside the product structure to add tags and information. All product statuses are of type "New", "Limited edition", "Sold out" ### Dos & Don'ts **Do** - Keep the label short, specific, and readable (ideally one or two words) - Use Badge to indicate status, category, or metadata - Place Badge inline with related content, such as next to titles or list items - Use Badge to complement information, not replace it. They should add clarity, not create ambiguity **Don't** - Don't use Badge as interactive element (e.g., buttons or filters) - Don't write long sentences or complex phrases inside a Badge - Don't use too many Badges in the same line or component, as this creates visual clutter - Don't place Badge far from the content they describe, proximity reinforces meaning ### Best Practices in Context 1. **Badge** 2. **Icon** - optional (left or right) 3. **Label** - optional (specific use case only) ## Placement Since it provides extra information to a sibling element, in can be used inside components in various places, referring to the nature of its environment. Multiple **Badges** can be displayed: * on a single line * stacked vertically ## Behavior As the **Badge** is an informational component, its default behavior is being read-only. An icon can be displayed on the left or right of the **Badge** label content. Icon-only **Badge** also exists, but it must meet accessibility requirements. See Accessibility section below. ## Variation ### Status - **Accent**: highlight an item tied to the brand, without conveying any particular status. - **Neutral**: label an item without conveying any particular status or urgency. - **Information** _(default)_: display neutral or informational messages, such as updates, notifications, or general status. - **Success**: indicate positive outcomes or successful actions, such as completed tasks or achievements. - **Warning**: alert users to potential issues or cautionary information, signaling that attention is needed. - **Critical**: highlight severe issues or errors that require immediate attention. - **Alpha** and **Beta**: flag a feature or a product in an early, not yet stable, stage. - **New**: flag a recently released feature or product. - **Promotion**: highlight a commercial offer, such as a discount or a limited-time deal. ### Emphasis - **High**: tinted background with a light border, for a status that must stand out at a glance. - **Medium** _(default)_: colored border and text on the raised surface, like the medium **Message**, for statuses that inform without competing with the content around them. - **Low**: colored text only, without background, for dense contexts such as tables or lists. The label must carry the meaning on its own, as the color is the only status cue. The promotional statuses (**Alpha**, **Beta**, **New** and **Promotion**) keep their filled look in every emphasis. The blue-jeans theme keeps the v19 tinted look in high, without border, and the v19 widths. ```tsx <>
Critical Information Neutral Success Warning
Critical Information Neutral Success Warning
Critical Information Neutral Success Warning
``` ### Size - **Small**: compact and unobtrusive counts or statuses, suitable for tight spaces and minimalistic designs. - **Medium** _(default)_: main size for displaying **Badges**. - **Large**: prominent and easily noticeable counts or statuses, suitable for emphasizing important information. ## Navigation The **Badge** component is non-interactive and does not receive keyboard focus. It is purely decorative and used to label an item, keyword, or status. ## Accessibility **Badges** are read by screen readers as regular text. Icon-only **Badge** is only used in very specific cases. In that case, it should be accompanied by a tooltip to provide further context. The accessibility of multiple **Badges** presented as a collection must be considered during its implementation. Their grouping should be made clear to assistive technologies and proper ARIA attributes must be added to ensure full accessibility. ### Icon-only Badge If a **Badge** contains only an icon, it must include an [aria-label](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-label) to provide context. ```tsx ``` Screen readers will announce the aria-label instead of ignoring the **Badge**. Since an icon-only **Badge** may lack detailed information, attach a tooltip and use an [aria-labelledby](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-labelledby) when extra context is needed: ```tsx Promotion valid from November 22 to 26 ``` Screen readers will announce the **Tooltip** content when focusing on the **Badge**. ### Structuring groups of Badges with lists When displaying multiple **Badges** together, they should be wrapped within an unordered list of items (`