Badge
A small non-interactive label for a status, count, or category, such as Live, Beta, or 3 new.
Variants
Every value of the attributes that change how it looks. The values come from the schema.
variant
Visual style variant
variant="default"variant="secondary"variant="outline"variant="success"variant="warning"variant="destructive"Examples
Each one rendered live, over the markup that produces it.
Default
<aihio-badge>New</aihio-badge>
Secondary
<aihio-badge variant="secondary">Draft</aihio-badge>
Outline
<aihio-badge variant="outline">v2.0</aihio-badge>
Destructive
<aihio-badge variant="destructive">Error</aihio-badge>
Mistakes
Each one beside its fix, with what aihio lint says about it. The prompt fragment gives agents the
same pairs, and the build fails if the linter stops catching one or a fix stops passing.
Badges are non-interactive labels.
Put interactive elements outside the badge.
Don't
<aihio-badge><aihio-button>Delete</aihio-button></aihio-badge>
aihio lint reports
-
invalid-childerror -
forbidden-descendanterror
Do
<aihio-cluster gap="tight">
<aihio-badge>Draft</aihio-badge>
<aihio-button variant="ghost" size="sm">Delete</aihio-button>
</aihio-cluster>
variant="primary" is not valid.
Use variant="default" for the primary style.
Don't
<aihio-badge variant="primary">New</aihio-badge>
aihio lint reports
-
invalid-enum-attributeerror Suggestsvariant="default"
Do
<aihio-badge variant="default">New</aihio-badge>
API
Every attribute, property, method, and event the schema declares for aihio-badge.
Attributes
variant-
one of
defaultsecondaryoutlinesuccesswarningdestructivedefaultdefault - Visual style variant
Slots
default- Badge text content
Composition
- Allowed children
- text
- Forbidden descendants
-
aihio-buttonaihio-inputaihio-dialog
Accessibility
What you have to provide, and what the component already does. The obligations with a rule are checked by
aihio lint and by the dev build's console warnings.
Your obligations
-
warn When badge conveys information not present elsewhere (e.g. unread count)Include the meaning in visible text or an aria-label on the surrounding context. Badges have no inherent role.
Not machine-checkable: a judgment for the author.
Handled for you
- Badge stays semantically neutral: it does not add button, alert, status, or live-region roles automatically.
In patterns
Canonical compositions that use aihio-badge.