Skip to content

Add DS::Pill component to consolidate scattered pill/badge patterns #1751

@gariasf

Description

@gariasf

Add a DS::Pill component

We don't have a shared pill/badge component in the DS namespace, so pill-shaped UI is reinvented across many partials with inconsistent classes. A few callsites also break the design-token rule (text-green-500 instead of text-success) and a few have failing WCAG AA contrast (text-on-own-tint pattern).

Proposed API

DS::Pill.new(
  variant: :neutral | :success | :warning | :error,
  label: String,
  dot: true | false,            # coloured semantic dot
  size: :sm | :md
)

Default visual (variant A from the contrast review): bg-surface-inset text-primary + a small coloured dot when dot: true. The dot carries the semantic meaning, the label sits in the high-contrast neutral pill — ships AA contrast for free, matches the existing _maturity_badge look.

Callsites to consolidate

Pill markup in the wild today:

  • app/views/settings/providers/_status_pill.html.erb
  • app/views/settings/providers/_maturity_badge.html.erb
  • app/views/shared/_badge.html.erb (uses raw text-green-500 etc — also breaks DS-token rule)
  • app/views/shared/_color_badge.html.erb
  • app/views/categories/_badge.html.erb
  • app/views/accounts/_tax_treatment_badge.html.erb (+ inline twin in app/views/reports/_investment_performance.html.erb:121)
  • app/views/import/qif_category_selections/show.html.erb:86 (inline, low contrast)
  • app/views/sophtron_items/_sophtron_item.html.erb:26 (inline, low contrast)
  • app/views/transactions/_transaction.html.erb (lines 92, 101, 106, 115 — pending / review-recommended / potential-duplicate / split badges)
  • app/views/transactions/_split_parent_row.html.erb:39
  • app/views/transactions/_header.html.erb:25
  • app/views/transactions/_transfer_match.html.erb (lines 9, 12)
  • app/views/transactions/searches/filters/_badge.html.erb
  • app/views/investment_activity/_badge.html.erb
  • app/views/investment_activity/_quick_edit_badge.html.erb:52
  • app/views/simplefin_items/_activity_badge.html.erb
  • app/views/budget_categories/_budget_category.html.erb:71
  • app/views/settings/preferences/show.html.erb (lines 65, 70, 170)

Out of scope

The immediate WCAG AA contrast fix on the providers settings status pill ships in PR #1710 by switching _status_pill to the variant-A look using existing tokens. This issue is the broader DS work to extract + unify.

Acceptance

  • DS::Pill ViewComponent + Lookbook preview
  • All callsites listed above migrated (or explicitly excluded with rationale)
  • No raw colour utilities (text-green-500 etc) remain in pill callsites
  • Existing visual regression set passes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions