Skip to main content

Status Badges

The :badge field type renders a value as a coloured badge. Map each value to a ct-badge-* class with badge_class.

Quick example​

column :status, field_type: :badge, badge_class: { approved: "ct-badge-green", draft: "ct-badge-yellow", rejected: "ct-badge-red" }
field :status, field_type: :badge, badge_class: STATUS_TAG_COLOR,
badge_helper_texts: { rejected: "Check rejection reason" }

badge_helper_texts adds a tooltip icon next to the badge for the given values.

note

The :tag field type and tag_class option were renamed to :badge and badge_class in v8.0.0. Using :tag raises an error at boot. See the v8.0.0 upgrade guide.

Options​

ClassPreviewUse Case Example
ct-badge-blueSampleActive, In Progress, Enabled
ct-badge-yellowSamplePending, Awaiting, Draft
ct-badge-orangeSampleOn Hold, Needs Review, Processing
ct-badge-purpleSampleScheduled, Queued, Resolved
ct-badge-cyanSampleInfo, Beta, Staging
ct-badge-greenSampleCompleted, Approved, Verified
ct-badge-graySampleInactive, Archived, Unknown
ct-badge-redSampleRejected, Failed, Blocked, Deleted

Removed aliases​

The following old class names are no longer supported: they have no styles, and field raises an error at boot if badge_class uses them. Replace them with the Catalyst equivalents:

RemovedUse Instead
active / active-onect-badge-blue
active-twoct-badge-yellow
active-threect-badge-orange
active-fourct-badge-purple
active-fivect-badge-cyan
completedct-badge-green
neutralct-badge-gray
dangerct-badge-red
warning

Bootstrap badge color classes (bg-success, bg-warning, bg-danger, bg-secondary) are not supported as badge classes. Always use ct-badge-* Catalyst Tags.

Choosing a colour​

  1. Use ct-badge-green for positive terminal states (approved, verified, done)
  2. Use ct-badge-red for negative terminal states (rejected, failed, blocked)
  3. Use ct-badge-gray for inactive or non-significant states (archived, unknown)
  4. Use ct-badge-blue for currently live or enabled items
  5. Use ct-badge-yellow for items awaiting action (pending, draft)
  6. Use ct-badge-orange through ct-badge-cyan to differentiate multiple intermediate states when two or more non-red/green statuses exist
  7. Never use Bootstrap badge color classes β€” they are not equivalent and will produce inconsistent styling

Recipes​

Add a tooltip explaining a state​

badge_helper_texts maps values to tooltip text shown on an icon next to the badge:

field :status, field_type: :badge, badge_class: STATUS_TAG_COLOR,
badge_helper_texts: { rejected: "Check rejection reason" }