Skip to content

Floating cards dashboard

Dashboard of floating cards with KPI charts.

Usage

Usage
import { FloatingDashboard } from '@/components/blocks/dashboard-02'


<FloatingDashboard />


// Fill a parent that has a height instead of the viewport
<FloatingDashboard height="100%" />


// Your own workspace, navigation and data
<FloatingDashboard
  workspaces={[{ id: 'acme', name: 'Acme Logistics', detail: 'Operations' }]}
  user={{ name: 'Sam Lee', email: 'sam@acme.dev', avatar: '/avatars/sam.jpg' }}
  title="Shipments overview"
  primaryAction={{ label: 'New shipment', onClick: () => open() }}
  kpis={kpis}
  series={series}
  seriesLabels={{ foot: 'Parcels', vehicle: 'Pallets' }}
  routes={lanes}
  activity={shipments}
  activeId={pathname}
  onNavigate={(id) => navigate(id)}
  onRangeChange={(range) => refetch(range)}
/>

Install

pnpm dlx shadcn@latest add @pastaui-pro/dashboard-02

Source

Props

Floating cards dashboard props
PropTypeDefaultDescription
workspacesFloatingWorkspace[]= Three workspacesWorkspaces in the switcher ({ id, name, detail? }). The first is selected unless defaultWorkspaceId is set.
defaultWorkspaceIdstring= First workspaceWorkspace selected on first render.
onWorkspaceChange(id: string) => void= —Called when another workspace is chosen.
navFloatingNavSection[]= Operations and Crew groupsSidebar groups ({ id, label?, items }). Each item has an id, label, icon, optional href and optional count.
footerNavFloatingNavItem[]= SettingsLinks pinned to the bottom of the sidebar.
activeIdstring= —Controlled id of the active nav item. Pair with onNavigate.
defaultActiveIdstring= 'overview'Active nav item on first render when uncontrolled.
onNavigate(id: string) => void= —Called when a nav link is chosen. The drawer closes itself.
userFloatingUser= Halvard BrannockSigned-in user ({ name, email, avatar? }) for the account menu. Initials are shown without an avatar.
notificationsFloatingNotification[]= Three notificationsItems in the notifications menu ({ id, title, time, unread? }). Unread items light the dot on the bell.
titlestring= 'Sailings overview'Page title at the top of the main card.
descriptionReactNode= One lineSupporting line under the title.
primaryAction{ label: string; onClick?: () => void }= { label: 'Schedule sailing' }The blue button next to the date range menu.
defaultRange'7d' | '30d' | '90d'= '30d'Date range on first render. It drives the KPI cards and the chart.
onRangeChange(range: '7d' | '30d' | '90d') => void= —Called when a range is picked from the date range menu or a KPI card’s period menu.
kpisFloatingKpi[]= Four KPIsKPI cards: id, label, format (number or percent), decimals, higherIsBetter, values (a { value, previous } pair for each range), today (text before 'today', such as '+1,204'), series (sparkline points { date, value } for each range), pointLabel (word after a value in the chart tooltip) and trend ('good', 'bad' or 'neutral' for green, red or blue; worked out from the change and higherIsBetter when omitted). Percent deltas show in points.
seriesFloatingSeriesPoint[]= 180 days of dataDaily points ({ date: YYYY-MM-DD, foot, vehicle }) stacked in the chart. 7 and 30 days show days, 90 days shows weeks.
seriesLabels{ foot: string; vehicle: string }= { foot: 'Walk-on', vehicle: 'With vehicle' }Names of the two series in the legend and tooltip.
routesFloatingRoute[]= Four routesRows in the route load list ({ id, from, to, load, sailings }).
activityFloatingSailing[]= Twelve sailingsTable rows: id, vessel, departs, from, to, captain, passengers, capacity and status (arrived, boarding, scheduled, delayed or cancelled). The search input filters them.
searchPlaceholderstring= 'Search sailings, vessels, crew'Placeholder of the search input.
onSearch(query: string) => void= —Called when Enter is pressed in the search input.
onUpgrade() => void= —Called from the upgrade prompt at the bottom of the sidebar.
shortcuts'auto' | 'within' | false= 'auto'Where Ctrl or Cmd + K (focus search) and Ctrl or Cmd + B (sidebar) work. 'within' handles them only while focus or the pointer is inside the dashboard, 'auto' also handles them anywhere when the dashboard fills the page, and false turns them off.
defaultCollapsedboolean= Below 1024pxStart with the sidebar folded to icons. Left unset, it folds when the dashboard is narrower than 1024px.
heightnumber | string= '100dvh'Height of the shell; the panes scroll inside it. Numbers are pixels and strings take any CSS length: '100%' fills a parent that has a height, such as the area under your own header, and 800 gives a fixed frame.
classNamestring= —Additional classes for the root. Use height rather than an h-* class.
styleCSSProperties= —Inline styles, handy for overriding the --pp-* theme variables.