Number column
NumberColumn right-aligns its cell and formats the value as a number for the viewer’s locale. It is
sortable and filters as a number.
NumberColumn::make('views')->label('Views')->compact()->sortable();NumberColumn::make('conversion')->label('Conversion') ->unit(NumberFormatUnit::Percent) ->decimals(1);- actionsLabel:"Actions"
- bulkActions:[]
- data:[{"conversion":0.128,"label":"Landing page","views":12400},{"conversion":0.064,"label":"Pricing","views":3820},{"conversion":0.011,"label":"Blog","views":1045000}]
- 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
- compact:true
- maximumFractionDigits:null
- minimumFractionDigits:null
- unit:null
- compact:false
- maximumFractionDigits:1
- minimumFractionDigits:1
- unit:"percent"
->decimals($min, $max?)fixes the fraction digits —->decimals(2)for exactly two, or->decimals(0, 2)for a min–max range.->unit(NumberFormatUnit::…)adds a locale-correct unit suffix —Percent,Kilogram,Byte, and the rest of theNumberFormatUnitcases. A percent value is scaled by the formatter, so store0.128to render12.8%.->compact()renders large numbers compactly (1.2K,3.4M).
use Lattice\Lattice\Core\Enums\NumberFormatUnit;
NumberColumn::make('weight')->unit(NumberFormatUnit::Kilogram)->decimals(1);NumberColumn::make('downloads')->compact();For a currency amount, reach for the dedicated Money column.