A wider screen, please

This page features interactive demos and side-by-side code samples that need at least 340 pixels of horizontal space. Please widen your browser window, or rotate your device, to continue.

Morpheus v0.3.0
v0.3.0

Badge#

Component <neo-badge> is a small inline label / chip for status, counts, tags, and category markers. Variants reuse the button colour tokens, which means a theme change restyles badges too.

Default
Variants
With icon
With status dot
As link
Counts
DeactivateRenameDuplicate
Delete
New state Toggle autoplay
New
HTMLCSS

The selected state's markup and its scoped CSS. The CSS is wrapped in <style>@scope { ... }</style> and applies to the preview only. Edits change the preview above, applied live while Sync is on, or when you click Patch or Replace. Patch morphs the preview; Replace swaps it outright.

ReplacePatch

Signals

Datastar signals declared in the selected state's markup. Change a value to update the preview, applied live while Sync is on, or when you click Patch.

Patch

Reference#

Attributes #

NameTypeDefaultDescription
variant"primary" | "secondary" | "danger" | "outline"noneVisual style. Omit for the default neutral chip.

CSS variables #

NameDefaultDescription
--neo-badge-padding-y0.125remVertical padding.
--neo-badge-padding-x0.5remHorizontal padding.
--neo-badge-radius9999pxCorner radius. Default fully rounds the chip into a pill.
--neo-badge-font-size0.75remLabel font size.
--neo-badge-font-weight600Label font weight.
--neo-badge-gap0.25remGap between an icon and the label.
--neo-badge-border-colorcolor-mix(in srgb, var(--page-fg) 14%, transparent)Border color of the default and outline chips.
--neo-badge-bgcolor-mix(in srgb, var(--page-fg) 6%, transparent)Background of the default chip.
--neo-badge-colorvar(--page-fg)Text color of the default chip.

Examples#

Variants#

The default (neutral), primary, secondary, danger, and outline (transparent with a border) fills are tied to the button colour tokens.

DefaultPrimarySecondaryDangerOutline

With icon#

Drop a <neo-icon> as the badge's first child. The flex layout spaces it from the label. The icon inherits the badge's font colour and recolours with the variant.

Saved Pro Failed Info Beta

With status dot#

A small inline <span> with a round background makes a status-indicator badge. A modifier class sets the dot colour per status.

Online Idle Error Offline

Wrap the badge in an <a>. Its display: inline-flex lets it nest inside inline anchors and pick up the link's hover and focus from the cascade.

Documentation Changelog

Counts#

Short numeric badges next to a label form the unread-count pattern. line-height: 1 keeps them from stretching the row at small font sizes.

Inbox12 Mentions3 Drafts42 Archive128

The badge sits on the text baseline and reads as part of a sentence without pushing surrounding lines apart. New tags roll out weekly and the experimental ones ship behind a beta flag.

Settings

Theme

DefaultSunshineOceanMatrixRose☀ ◐ ☾

Accessibility

Playgrounds

Server Simulator