Skip to content
All components

Components

Badge

A badge names a state in a word or two, such as Live, Draft or 3 new. Its tone picks the colour from the theme, so the same word reads the same on every screen. It is a label, not a control; to act on something, use a button.

Tones

A tone gives the badge its meaning; the words carry it too.

LiveTrialDue soonOverdue
Badge { text: "Live".into(), tone: Tone::Ok }.html(out);
Badge { text: "Trial".into(), tone: Tone::Info }.html(out);
Badge { text: "Due soon".into(), tone: Tone::Warn }.html(out);
Badge { text: "Overdue".into(), tone: Tone::Bad }.html(out);

Neutral and brand

Neutral for counts and tags, brand for the product's own label.

12 tagsNew
Badge { text: "12 tags".into(), tone: Tone::Neutral }.html(out);
Badge { text: "New".into(), tone: Tone::Brand }.html(out);

Beside a title

A badge qualifies what it sits next to.

Acme renewal Pilot
out.push_str("<b>Acme renewal</b> ");
Badge { text: "Pilot".into(), tone: Tone::Info }.html(out);

On the Mac

The same vocabulary drawn by Ocean UI's native face (egui on Metal), as the gallery's snapshot.

Badge drawn by Ocean UI's native face, darkBadge drawn by Ocean UI's native face, light

Use it

Web

use ocean_ui_core::{Badge, Tone};
Badge { text: "Live".into(), tone: Tone::Ok }

Native

use ocean_ui_native::{Show, core::{Badge, Tone}};
Badge { text: "Deployed".into(), tone: Tone::Ok }.show(ui);

Cargo feature base of ocean-ui-core, ocean-ui-web and ocean-ui-native; available since 2026-10-29.

In App UI, the grid block draws it from YAML.

Props

NameTypeDefaultWhat
textString—The words in the pill, short and in sentence case.
toneToneNeutralNeutral, Ok, Warn, Bad, Info or Brand: what the label means.

Accessibility

  • The badge is a span of plain text, so a screen reader reads its words in place.
  • The tone is colour only, so the words must carry the meaning on their own.
  • It takes no focus and no clicks.

Related

Markdown

The same page as Markdown, for an agent or a pull request.

Search

esc

Components

Blocks

Screens built from blocks

The Ocean app

Ocean Base console