Stats
Data visualization components for displaying key metrics, numbers, and statistics with optional titles, descriptions, and visual indicators. Perfect for dashboards, analytics panels, and data-driven interfaces with flexible layouts and styling options.
Stats have a transparent background by default. Use bg-base-100 if you
need a background color.
Basic Stats
Stats are used to display simple data points. They can be used to display a number (the main content), a title, and a description.
.bg-base-100.lg:grid.lg:grid-cols-3.items-center.gap-x-4.border.rounded-lg{ class: "w-full max-w-80 lg:w-full lg:max-w-[800px]" }
= daisy_stat do
= number_to_currency(8619.45)
= daisy_stat(title: "Views", description: "Views in the last 24 hours.") do
= number_with_delimiter(1208)
- # Example passing options as blocks. This allows you to pass in HTML.
= daisy_stat do |stat|
- stat.with_title do
Average Cart Value
= number_to_currency(319, precision: 0)
- stat.with_description do
You're doing quite well on your ACV!
Complex Stats
Stats can also be used to display more complex data points. You can pass in an image, an icon, or any other content you'd like.
.bg-base-100.lg:grid.lg:grid-cols-3.items-center.gap-x-4.border.rounded-lg{ class: "w-full max-w-80 lg:w-full lg:max-w-[900px]" }
= daisy_stat(css: "max-w-80", title: "Tasks", description: "Completed this month.", src: image_path("avatars/lady-smiling-1.jpg")) do
25
= daisy_stat(css: "max-w-80", title: "Students", description: "Total enrollments.", icon: "academic-cap") do
= number_with_delimiter(1112)
= daisy_stat(css: "max-w-80") do |stat|
- stat.with_title do
New Students
42
- stat.with_description do
New students in July!
- stat.with_figure do
= daisy_badge(css: "badge-primary") do
New!