Status Tags
Overviewâ
CmAdmin provides a set of Catalyst Tag classes used to display enum or state values with a colored badge. These are rendered via the :badge field type and are controlled using the badge_class option.
column :status, field_type: :badge, badge_class: { approved: 'cm-badge-green', draft: 'cm-badge-yellow', rejected: 'cm-badge-red' }
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.
All tag classes use a cm-badge- prefix (Catalyst Tag) to avoid conflicts with generic CSS utility classes.
Available Tag Classesâ
| Class | Preview | Use Case Example |
|---|---|---|
cm-badge-blue | Sample | Active, In Progress, Enabled |
cm-badge-yellow | Sample | Pending, Awaiting, Draft |
cm-badge-orange | Sample | On Hold, Needs Review, Processing |
cm-badge-purple | Sample | Scheduled, Queued, Resolved |
cm-badge-cyan | Sample | Info, Beta, Staging |
cm-badge-green | Sample | Completed, Approved, Verified |
cm-badge-gray | Sample | Inactive, Archived, Unknown |
cm-badge-red | Sample | Rejected, 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:
| Removed | Use Instead |
|---|---|
active / active-one | cm-badge-blue |
active-two | cm-badge-yellow |
active-three | cm-badge-orange |
active-four | cm-badge-purple |
active-five | cm-badge-cyan |
completed | cm-badge-green |
neutral | cm-badge-gray |
danger | cm-badge-red |
Bootstrap badge color classes (bg-success, bg-warning, bg-danger, bg-secondary) are not supported as badge classes. Always use cm-badge-* Catalyst Tags.
Best Practicesâ
- Use
cm-badge-greenfor positive terminal states (approved, verified, done) - Use
cm-badge-redfor negative terminal states (rejected, failed, blocked) - Use
cm-badge-grayfor inactive or non-significant states (archived, unknown) - Use
cm-badge-bluefor currently live or enabled items - Use
cm-badge-yellowfor items awaiting action (pending, draft) - Use
cm-badge-orangethroughcm-badge-cyanto differentiate multiple intermediate states when two or more non-red/green statuses exist - Never use Bootstrap badge color classes â they are not equivalent and will produce inconsistent styling