Skip to content

Badge column

BadgeColumn renders the value as a pill. It is sortable and filterable like a text column, and reads its colour from a fixed value-to-tone map.

TextColumn::make('reference')->label('Reference');
BadgeColumn::make('status')->label('Status')
->colors(['paid' => 'green', 'pending' => 'yellow', 'refunded' => 'gray'])
->filterable();

->colors([value => color]) maps cell values to a colour name — gray, red, orange, yellow, green, blue, purple, or the semantic default, muted, primary, success, info, warning, danger — or any CSS colour. 'green', Color::green(), Color::hex('#16a34a'), and Color::hex('#2563eb')->dark('#60a5fa') are all accepted. Unmapped values fall back to gray.

BadgeColumn::make('status')->colors([
'draft' => 'gray',
'active' => 'green',
'suspended' => 'red',
])->filterOptions([
'draft' => 'Draft',
'active' => 'Active',
'suspended' => 'Suspended',
]);

When the colour lives on the row instead of a fixed map — a status_color field — a Text column’s ->badge() reads it per row.