Back to Chromium

Component Spec: ListItemBadge

agents/projects/chrome-design-system/assets/component-specs/ListItemBadge_Spec.md

153.0.7995.12.9 KB
Original Source

Component Spec: ListItemBadge

This specification document outlines the mapping, design tokens, styling variants, and interactive states of the ListItemBadge component across Figma, C++ Views, and WebUI (Web Frontend).


Overview

The ListItemBadge component acts as a supplementary metadata pill, typically docked within lists or rows. It displays text, icons, and occasionally crossed-out original values (e.g., for "Updated Status").


1. Component Metadata & Source Files

FeatureFigma ComponentC++ Views (Desktop)WebUI (Web Frontend)
Component NameListItemBadgeCustom / views::BadgeCustom CSS / cr-badge
Source FilesFigma Link: 280:27248ui/views/controls/badge.hN/A

2. Styling, Variants & Features (Layout & Style)

Figma VariantC++ ClassesWebUI Element/Class
DefaultGeneric ViewCustom HTML/CSS
Updated StatusCustom layoutCustom HTML/CSS

3. Component States

This component is strictly informational and does not feature interactive states (Hovered, Pressed) natively.

Interactive StateFigmaC++WebUI
DefaultN/ANormal paintingNormal layout

4. Design Token Comparison (Side-by-Side)

Token TypeFigma PropertyC++ ViewsWebUI Variable / CSS
Default BackgroundNeutral ContainerBackgroundCSS classes
Updated BackgroundTertiary ContainerN/ACSS classes
Corner RadiusFully Rounded (999px)Canvas roundingborder-radius: 999px
TypographyBody Five (11px)N/AFont sizes

5. Architectural & Implementation Gaps

  • No direct UI primitive: WebUI and C++ Views do not offer a generalized ListItemBadge with native crossed-out status layouts. Consumers must build this using flexbox (<div class="badge">) in WebUI or a composite views::View with multiple views::Labels in C++.
  • views::Badge: The standard C++ views::Badge (ui/views/controls/badge.h) is heavily restricted to displaying text on a blue background, which does not cover the visual diversity requested in Figma (like "Updated Status" with tertiary green colors and icons).

6. Styling, Variants, Features and States Mismatches

  • Strikethrough styling: The "Updated Status" variant requires explicit CSS (text-decoration: line-through) or views::Label text styles to render correctly, which must be hand-assembled by developers.

7. Usage & UX Guidance

1. General Principles & Best Practices

  • Context: Use within complex list items to highlight changes or small tags.

8. Inheritance Structure

  • C++ Views (Desktop): N/A
  • WebUI (Web Frontend): N/A