noora
Sign in

Badge

Labels an item with a short category or status. The status badge shows the state of a build, test run, or job with a consistent icon and color.

Variants

Each color comes as a solid fill and a softer light-fill . neutral is the default color.

Neutral Neutral
Primary Primary
Secondary Secondary
Information Information
Focus Focus
Success Success
Attention Attention
Warning Warning
Destructive Destructive
<div :for={
  color <- ~w(neutral primary secondary information focus success attention warning destructive)
}>
  <.badge size="large" label={String.capitalize(color)} color={color} />
  <.badge size="large" label={String.capitalize(color)} color={color} style="light-fill" />
</div>

With icons

An icon before the label, in every color, style, and size.

Neutral
Neutral
Neutral
Neutral
Neutral
Neutral
Primary
Primary
Primary
Primary
Primary
Primary
Secondary
Secondary
Secondary
Secondary
Secondary
Secondary
Information
Information
Information
Information
Information
Information
Focus
Focus
Focus
Focus
Focus
Focus
Success
Success
Success
Success
Success
Success
Attention
Attention
Attention
Attention
Attention
Attention
Warning
Warning
Warning
Warning
Warning
Warning
Destructive
Destructive
Destructive
Destructive
Destructive
Destructive
<div :for={
  color <- ~w(neutral primary secondary information focus success attention warning destructive)
}>
  <.badge
:for={size <- ~w(large medium small)}
    label={String.capitalize(color)}
    color={color}
    size={size}
  >
    <:icon><.bell /></:icon>
  </.badge>
  <.badge
:for={size <- ~w(small medium large)}
    label={String.capitalize(color)}
    color={color}
    style="light-fill"
    size={size}
  >
    <:icon><.bell /></:icon>
  </.badge>
</div>

Sizes

Small is the default. Medium suits headers and cards with more room, and large suits page headers.

Small Medium Large
<.badge label="Small" size="small" color="primary" />
<.badge label="Medium" size="medium" color="primary" />
<.badge label="Large" size="large" color="primary" />

Dot and icon

A dot or an icon before the label reinforces the status at a glance.

Live
Flaky
<.badge size="large" label="Live" color="success" style="light-fill" dot />
<.badge size="large" label="Flaky" color="warning" style="light-fill">
  <:icon><.alert_circle /></:icon>
</.badge>

Disabled

Ignores the color and uses the disabled presentation.

Disabled
<.badge size="large" label="Disabled" color="success" disabled />

Status badge

Each status has its own icon.

Passed Failed Cancelled Flaky Running Skipped
<.status_badge status="success" label="Passed" />
<.status_badge status="error" label="Failed" />
<.status_badge status="warning" label="Cancelled" />
<.status_badge status="attention" label="Flaky" />
<.status_badge status="in_progress" label="Running" />
<.status_badge status="disabled" label="Skipped" />

Status badge with a dot

type="dot" replaces the icon with a dot in the status color.

Passed Failed Cancelled Flaky Running Skipped
<.status_badge type="dot" status="success" label="Passed" />
<.status_badge type="dot" status="error" label="Failed" />
<.status_badge type="dot" status="warning" label="Cancelled" />
<.status_badge type="dot" status="attention" label="Flaky" />
<.status_badge type="dot" status="in_progress" label="Running" />
<.status_badge type="dot" status="disabled" label="Skipped" />

Guidelines

  • Keep labels to one or two words. A badge annotates something else and should not carry a sentence.
  • Pick the color for its meaning, not for decoration: success for healthy or passing, destructive for failures, warning and attention for things that need a look.
  • Use light-fill when several badges sit together, so the row stays calm. Save fill for the one that needs attention.
  • For run and job states, use the status badge, which pairs each state with a consistent icon.
  • Map each outcome to the same status everywhere: success for passed, error for failed, warning for cancelled, in_progress for running.
  • The status sets the status badge's icon and its color, and disabled also mutes the label. Write the label for the outcome, such as Passed or Failed.
  • Use type="dot" in dense lists where the status icons would compete with the content.

API reference

<.badge>

Attribute Type Default Description
color
string
"neutral"
Controls the semantic color. Disabled badges ignore this value. "neutral""destructive""warning""attention""success""information""focus""primary""secondary"
disabled
boolean
false
Uses the disabled presentation regardless of color.
dot
boolean
false
Displays a dot before the label when the icon slot is empty.
label Required
string
–
The text displayed in the badge.
size
string
"small"
Controls the badge dimensions and text size. "small""medium""large"
style
string
"fill"
Controls whether the badge uses a solid or light fill. "fill""light-fill"

Also accepts global attributes.

Slot Description
:icon
The icon to render next to the label. Overrides the dot attribute.

<.status_badge>

Attribute Type Default Description
label Required
string
–
The label of the badge
status Required
string
–
The status of the badge "success""error""warning""attention""disabled""in_progress"
type
string
"icon"
Whether to render the prefix as a dot, or a status-specific icon "icon""dot"

Also accepts global attributes.