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();- actionsLabel:"Actions"
- bulkActions:[]
- data:[{"reference":"ORD-501","status":"paid"},{"reference":"ORD-502","status":"pending"},{"reference":"ORD-503","status":"refunded"}]
- emptyLabel:"No results"
- endpoint:null
- filters:[]
- layout:null
- lazy:null
- pagination:{"currentPage":null,"from":1,"hasMore":false,"lastPage":null,"mode":"none","nextPage":null,"perPage":null,"to":3,"total":3}
- resizableColumns:null
- resizeIndicator:false
- state:{"filters":[],"page":1,"perPage":25,"sorts":[],"tableFilters":[]}
- striped:null
- badge:null
- copyable:false
- date:null
- link:null
- multiple:null
- colors:{"paid":"green","pending":"yellow","refunded":"gray"}
->colors([value => color]) maps cell values to a colour name — gray, red, green, yellow,
blue, purple, or orange. 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.