Skip to content

Dashboard Reference ​

Experimental

Dashboards are experimental: the DSL and behavior may change in a future release.

Reference documentation for Plutonium dashboards: pages of metric, chart and free-form cards, each loaded in its own lazy turbo frame.

In this section ​

PageWhat it covers
DSLPlutonium::Dashboard::Base, presents, refresh, width, and the metric / chart / card macros with every option
Registrationregister_dashboard, the routes it draws, the synthesized controller, the sidebar, and the pu:dashboard generator

Quick start ​

ruby
# packages/admin_portal/app/dashboards/admin_portal/sales_dashboard.rb
module AdminPortal
  class SalesDashboard < Plutonium::Dashboard::Base
    presents label: "Sales", icon: Phlex::TablerIcons::ChartBar

    metric(:orders) { {value: Order.this_month.count, previous: Order.last_month.count} }
    chart(:revenue, type: :area, span: 8) { Order.group_by_day(:created_at).sum(:total) }
  end
end

# packages/admin_portal/config/routes.rb
AdminPortal::Engine.routes.draw do
  register_dashboard AdminPortal::SalesDashboard, at: "sales"
end

See the Dashboards guide for a full walkthrough.

Released under the MIT License.