-
Notifications
You must be signed in to change notification settings - Fork 17
Docs/badge guide #263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kathrinschalber
wants to merge
33
commits into
development
Choose a base branch
from
docs/badge-guide
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Docs/badge guide #263
Changes from 25 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
92909aa
Add base file structure for Badge component
kathrinschalber da7a2c4
added suggestions
kathrinschalber 2a82118
feat(badge): add guidelines and code for badge
alexkaduk 08aac21
feat(badge): add guidelines and code for badge
alexkaduk e7b0476
Fix typo in ideation file
kathrinschalber 0ce422c
docs: usage guide for badge
flxlst09 777251f
feat(badge): add guidelines and code for badge
alexkaduk 563ea5a
feat(badge): add guidelines and code for badge
alexkaduk cb2a756
feat(badge): add guidelines and code for badge
alexkaduk cc383e1
feat(badge): add guidelines and code for badge
alexkaduk 832d77c
feat(badge): add guidelines and code for badge
alexkaduk ca150e8
feat(badge): add guidelines and code for badge
alexkaduk 92cc13a
feat(badge): add guidelines and code for badge
alexkaduk 44805ac
feat(badge): add guidelines and code for badge
alexkaduk 32783bb
feat(badge): add guidelines and code for badge
alexkaduk 71d01c9
feat(badge): add guidelines and code for badge
alexkaduk c8256a7
feat(badge): add guidelines and code for badge
alexkaduk a12604a
feat(badge): add guidelines and code for badge
alexkaduk 46caf85
docs: update badge guide
flxlst09 6785fa0
Merge branch 'docs/badge-guide' of github.com:siemens/ix-docs into doβ¦
flxlst09 8fee493
feat(badge): add guidelines and code for badge
alexkaduk 958efc4
Merge branch 'development' into docs/badge-guide
kathrinschalber a1866ec
Apply suggestions from review
kathrinschalber be4f19e
Applied feedback from review
kathrinschalber 3441cf7
Readded production, removed pullrequest env file
kathrinschalber 73d86f1
Applied feedback from coderabbit review
kathrinschalber a217924
feat(badge): add guidelines and code for badge
alexkaduk db4d7f0
feat(badge): add guidelines and code for badge
alexkaduk 474d216
feat(badge): add guidelines and code for badge
alexkaduk cafd715
feat(badge): add guidelines and code for badge
alexkaduk eb10a6a
Applied feedback from development review
kathrinschalber 6d94ee8
Apply suggestions from final edit (direct changes)
kathrinschalber 2015192
Apply feedback from final edit
kathrinschalber File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| --- | ||
| doc-type: 'tab-item' | ||
| description: 'Code examples and API documentation for the ix-badge' | ||
| --- | ||
|
|
||
| import PropsApi from '@site/docs/autogenerated/api/ix-badge/api.mdx'; | ||
| import BadgePlayground from '@site/docs/autogenerated/playground/badge.mdx'; | ||
| import BadgeCounterPlayground from '@site/docs/autogenerated/playground/badge-counter.mdx'; | ||
| import BadgeLabelPlayground from '@site/docs/autogenerated/playground/badge-label.mdx'; | ||
| import BadgeDotPlayground from '@site/docs/autogenerated/playground/badge-dot.mdx'; | ||
| import BadgeStatusIconPlayground from '@site/docs/autogenerated/playground/badge-status-icon.mdx'; | ||
|
|
||
| # Badge - Code | ||
|
|
||
| ## Basic | ||
|
|
||
| <BadgePlayground height="15rem" /> | ||
|
|
||
| ## Counter | ||
|
|
||
| <BadgeCounterPlayground height="24rem" /> | ||
| ## Label | ||
|
|
||
| <BadgeLabelPlayground height="24rem" /> | ||
|
|
||
| ## Dot | ||
|
|
||
| <BadgeDotPlayground height="20rem" /> | ||
|
|
||
| ## Status icon | ||
|
|
||
| <BadgeStatusIconPlayground height="19rem" /> | ||
|
|
||
| <PropsApi /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,108 @@ | ||
| --- | ||
| doc-type: 'tab-item' | ||
| description: 'Usage guide for the badge component' | ||
| --- | ||
| # Badge - Usage | ||
|
|
||
| Badges are non-interactive visual aids for status, counters and notification cues. We recommend badges when users need a compact signal next to another element or a lightweight standalone status cue. | ||
|
|
||
|  | ||
|
|
||
| 1. Badge of type `label` as standalone | ||
| 2. Badge of type `counter` | ||
| 3. Badge of type `dot` | ||
| 4. Badge of type `status icon` | ||
| 5. Anchor element | ||
|
|
||
| Badges work **standalone** or **attached** to an anchor that represents the related information. As a general rule, we use badges for dynamic status or notification information and [chips](../chip) when users need to interact with the item. | ||
|
|
||
| ## Types | ||
|
|
||
| Badge types define how the indicator appears: | ||
|
|
||
| - **Counter (default):** Use for notifications that need attention, with integers up to two digits ("99+" for larger values). Short words are an exception, e.g. "new". | ||
| - **Label:** Use for a readable status, e.g. "Online" or "Offline" in a list. | ||
| - **Dot:** Use when only the presence of new information matters, e.g. for a compact notification that needs attention without a count. | ||
|
tokyojen marked this conversation as resolved.
|
||
| - **Status icon:** Use for showing statuses or notifications that are recognizable by icon alone. | ||
|
|
||
| ## Variants | ||
|
|
||
| Semantic color variants communicate meaning, not decoration: | ||
|
kathrinschalber marked this conversation as resolved.
Outdated
|
||
|
|
||
|  | ||
|
|
||
| - **Primary:** Highlight new features or exploratory information. | ||
| - **Alarm:** Show negative values, removals or high-urgency counts, e.g. critical equipment faults or imminent system failures. | ||
| - **Critical:** Emphasize severe conditions that require strong attention. | ||
| - **Warning:** Call attention to information that requires caution, e.g. pending actions. | ||
| - **Info:** Draw attention to new or updated information or informative numeric data. | ||
| - **Success:** Show positive values or additions, e.g. growth metrics. | ||
| - **Neutral:** Use for general-purpose information that doesnβt carry semantic meaning. | ||
| - **Custom:** Set an explicit background and badge color when you need a product-specific palette. | ||
|
|
||
| We recommend matching icons on label badges to the meaning of the chosen color. Prefer outlined styles when you need lower visual emphasis on busy surfaces. | ||
|
|
||
| :::info | ||
| Use standalone label badges to replace deprecated [pills](../pill) usages, e.g. compact statuses or categories. | ||
|
kathrinschalber marked this conversation as resolved.
|
||
| ::: | ||
|
|
||
| ## Options | ||
|
|
||
|  | ||
|
kathrinschalber marked this conversation as resolved.
|
||
|
|
||
| - **Placement:** Use inline (standalone) to show an entityβs status in a list. With an anchor, we typically use `top after` for notifications that need attention and `bottom after` for status on individual elements, e.g. user presence. | ||
| - **Label:** We usually show the full status name and use max-width to control lengthy labels. Keep labels short to avoid truncation. | ||
| - **Outline:** Intended for lower visual emphasis on standalone badges. On status icons, outline selects the outline glyph. | ||
| - **Border:** Add a high-contrast border on filled badges when the surface behind them is busy. Not applicable to outline badges. | ||
| - **Offset:** Keep the indicator close to the anchor without covering it fully and without leaving the parent's visual bounding box, e.g. round elements like avatars need larger negative offsets. | ||
| - **Pulse animation:** Use only for immediate, urgent attention. Note that it might not be visible with certain a11y browser configurations. | ||
| - **Custom colors:** With the custom variant, set background and badge color together so contrast stays readable. | ||
| - **Tooltip text**: For standalone badges, provide a specific text to be displayed as the tooltip or set the attribute without a specific value to display the badge's text content. | ||
|
tokyojen marked this conversation as resolved.
Outdated
|
||
|
|
||
| ## Behavior in context | ||
|
kathrinschalber marked this conversation as resolved.
|
||
|
|
||
|  | ||
|
|
||
| - **Overflow:** With a max width, label text truncates. Counter badges do not provide an overflow due to limited character count. | ||
| - **Container and overlapping:** An attached badge overlaps the anchor at its edge without extending the parentβs bounding box. This placement leaves the anchor recognizable and its critical content, e.g. the icon that identifies a notification button, visible. | ||
|
kathrinschalber marked this conversation as resolved.
Outdated
|
||
| - **Accessibility** | ||
| - **Accessible naming:** When badges are attached, include their meaning in the anchorβs accessible name, e.g. βNotifications, 3 unreadβ. Standalone dot and status icon badges need an accessible name because they donβt contain readable text. | ||
| - **Dynamic updates:** We recommend a polite live region when users need to hear an important badge update without moving focus. Reserve assertive announcements for critical conditions that require immediate attention, and donβt announce routine count changes. | ||
| - **Reading order:** Treat an attached badge and its anchor as one accessible unit. Avoid exposing the same information separately when this causes duplicate announcements. | ||
|
kathrinschalber marked this conversation as resolved.
Outdated
|
||
|
|
||
| ## States | ||
|
|
||
| Badges are read-only. They don't have hover, active, or disabled states, but support text selection. If enabled, badges are pulsing until the application disables them. | ||
|
kathrinschalber marked this conversation as resolved.
Outdated
|
||
|
|
||
| ## Dos and Donβts | ||
|
|
||
| <div class="dos-and-donts"> | ||
| <div class="dos"> | ||
| <ul aria-label="Recommended practices"> | ||
| <li>Do keep counter labels to integers with at most two digits, using 99+ when needed</li> | ||
|
kathrinschalber marked this conversation as resolved.
Outdated
|
||
| <li>Do attach badges to the control that opens or represents the related information</li> | ||
| <li>Do prefer dot or status icon badges over long labels in compact layouts</li> | ||
| <li>Do keep badges synchronized with the underlying notification state</li> | ||
| <li>Do include the badge meaning in the accessible name of its anchor</li> | ||
| <li>Do announce meaningful dynamic updates without announcing every routine count change</li> | ||
|
kathrinschalber marked this conversation as resolved.
Outdated
|
||
| <li>Do keep the badge inside the parent and leave enough of the anchor visible</li> | ||
| <li>Keep badges synchronized with the underlying notification state. Update or remove the indicator when users read notifications or when the status changes, and donβt leave stale counts or statuses attached to an anchor.</li> | ||
|
kathrinschalber marked this conversation as resolved.
Outdated
|
||
| </ul> | ||
| </div> | ||
| <div class="donts"> | ||
| <ul aria-label="Practices to avoid"> | ||
| <li>Donβt make badges interactive, use chips when users need to click or dismiss</li> | ||
|
kathrinschalber marked this conversation as resolved.
Outdated
|
||
| <li>Donβt use color alone to convey meaning without supporting text or ARIA on the host or anchor</li> | ||
| <li>Donβt rely on pulse animation for long-running or low-priority hints</li> | ||
| <li>Donβt place essential primary content only in a badge</li> | ||
| </ul> | ||
| </div> | ||
| </div> | ||
|
|
||
| ## Related | ||
|
|
||
| - [Pill](../pill) | ||
| - [Chip](../chip) | ||
| - [Popover](../popover) | ||
| - [UX writing basics](../../guidelines/language/basics) | ||
| - [Accessibility](../../guidelines/accessibility) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| doc-type: "tabs" | ||
| description: 'Badges display compact status, counter or notification cues on or next to UI elements.' | ||
|
kathrinschalber marked this conversation as resolved.
Outdated
|
||
| title: 'Badge' | ||
| --- | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
tokyojen marked this conversation as resolved.
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.