Skip to content
Shamar

Stat

From the /demo dashboard widget grid.
import { Stat, html } from '@shamar/core'
Stat.make('Unique views', '192.1k')
.description('32k increase')
.descriptionIcon('arrow-trending-up')
.descriptionColor('success')
.icon('eye')
.color('success')
.chart([7, 2, 10, 3, 15, 4, 17])
.chartColor('success')
.url('/admin/analytics')
.openUrlInNewTab()
.extraAttributes({ 'wire:click': '…' })
.columnSpan(2)
Stat.make('Missing', null).placeholder('—')
Stat.configureUsing((stat) => {
stat.placeholder('-')
})
Stat.make('Rich', html('<em>1.2k</em>'))

Methods

MethodDescription
make(label, value)Label/value; value may be null (uses placeholder).
description / descriptionIcon / descriptionColorFooter line + icon.
icon / color / chart / chartColorCard icon, accent, sparkline.
url / openUrlInNewTab / extraAttributesClickable card.
placeholder / columnSpanEmpty state and grid span.
configureUsingGlobal defaults for every Stat.make().
html()Trusted HTML helper for label/value/description.