DDBS UI
dashboard

Dashboard Cards

DashCard, DashKpiStrip, DashRosterCard, DashAgendaCard, DashProgressListCard, DashEntityCard, DashRecordCard, DashNotificationList and DashActivityFeed: the widgets that fill a dashboard grid.

npx shadcn@latest add https://ui.develop-better-solutions.com/r/dash-cards.json
Dependencies:lucide-react
Fullscreen
Trucks inside
12

Active status

Unassigned
48

Pending status

Docks in use
6/10

60% usage

Dispatch ready
04

Ready for today

Doctors

Appointments2

Checkup progress

Loading

TRC-204

6,500 kg (48%)

Cargo boxes

NY → NJ

Marcus Lee • Dock 3

Load progress48%

Medical information

Cameron Williamson

Patient

History
Inpatient care
Medications
Herbal medicine
Allergies
None
Physician
Dr. Berrada

Notifications2

  • Lab results are readyThree reports need review.2m
  • Shift swap approved1h
  • Low stock: glovesRestock before Friday.3h

Recent activity

  1. Nadia Fassi checked in for 10:20 consultation

    5 minutes ago

  2. Dr. Alaoui updated the care plan of Karim Idrissi

    32 minutes ago

  3. Leila Bennani booked a follow-up

    Yesterday

Usage

dash-cards-example.tsx
"use client";

import { useState } from "react";
import { CalendarDays, Clock3, Package, Truck } from "lucide-react";
import { DashActivityFeed, DashAgendaCard, DashEntityCard, DashKpiStrip, DashNotificationList, DashProgressListCard, DashRecordCard, DashRosterCard, type DashAgendaItem, type DashNotice } from "@dbs/ui";
import { DashScope } from "./_store";

const PEOPLE = [
  { id: "1", name: "Dr. Amal Berrada", subtitle: "Cardiologist", avatarSrc: "/samples/avatar-mira.jpg", status: { label: "On duty", tone: "info" as const } },
  { id: "2", name: "Dr. Youssef Alaoui", subtitle: "Neurologist", avatarSrc: "/samples/ipsum-man.jpg", status: { label: "Available", tone: "ok" as const } },
  { id: "3", name: "Dr. Salma Tazi", subtitle: "Pediatrician", status: { label: "On leave", tone: "danger" as const } },
];

export default function DashCardsExample() {
  const [agenda, setAgenda] = useState<DashAgendaItem[]>([
    { id: "a", time: "09:20", name: "Nadia Fassi", subtitle: "Follow-up", done: true },
    { id: "b", time: "10:20", name: "Karim Idrissi", subtitle: "Medication review" },
    { id: "c", time: "12:20", name: "Leila Bennani", subtitle: "Wound dressing" },
  ]);
  const [notes, setNotes] = useState<DashNotice[]>([
    { id: "n1", title: "Lab results are ready", body: "Three reports need review.", time: "2m", tone: "info", unread: true },
    { id: "n2", title: "Shift swap approved", time: "1h", tone: "ok", unread: true },
    { id: "n3", title: "Low stock: gloves", body: "Restock before Friday.", time: "3h", tone: "danger" },
  ]);
  return (
    <DashScope minHeight={0} className="!p-4 sm:!p-6">
      <div className="grid gap-4 lg:grid-cols-3">
        <DashKpiStrip
          className="lg:col-span-3"
          items={[
            { label: "Trucks inside", value: 12, hint: "Active status", icon: <Truck /> },
            { label: "Unassigned", value: 48, hint: "Pending status", icon: <Package /> },
            { label: "Docks in use", value: "6/10", hint: "60% usage", icon: <Clock3 /> },
            { label: "Dispatch ready", value: "04", hint: "Ready for today", icon: <CalendarDays /> },
          ]}
        />
        <DashRosterCard title="Doctors" people={PEOPLE} searchable onSelect={() => undefined} />
        <DashAgendaCard title="Appointments" items={agenda} onToggle={(i) => setAgenda((l) => l.map((x) => (x.id === i.id ? { ...x, done: !x.done } : x)))} onAdd={() => undefined} />
        <DashProgressListCard
          title="Checkup progress"
          items={[
            { id: "1", label: "22 August, 2024", progress: 32, note: "Blood panel scheduled.", icon: <CalendarDays /> },
            { id: "2", label: "16 August, 2024", progress: 64, note: "Imaging done, report pending.", icon: <CalendarDays /> },
          ]}
        />
        <DashEntityCard title="TRC-204" subtitle="6,500 kg (48%)" status={{ label: "Loading", tone: "warn" }} media={{ src: "/samples/steps-boxes.jpg", alt: "Cargo boxes" }} primary="NY → NJ" secondary="Marcus Lee • Dock 3" progress={{ label: "Load progress", value: 48 }} onOpen={() => undefined} />
        <DashRecordCard title="Medical information" person={{ name: "Cameron Williamson", role: "Patient", avatarSrc: "/samples/reviewer-2.jpg" }} qrSeed="cameron-williamson" fields={[{ label: "History", value: "Inpatient care" }, { label: "Medications", value: "Herbal medicine" }, { label: "Allergies", value: "None" }, { label: "Physician", value: "Dr. Berrada" }]} />
        <DashNotificationList items={notes} onMarkAllRead={() => setNotes((l) => l.map((n) => ({ ...n, unread: false })))} />
        <DashActivityFeed
          className="lg:col-span-3"
          items={[
            { id: "1", actor: "Nadia Fassi", action: "checked in for", target: "10:20 consultation", time: "5 minutes ago", avatarSrc: "/samples/reviewer-1.jpg" },
            { id: "2", actor: "Dr. Alaoui", action: "updated the care plan of", target: "Karim Idrissi", time: "32 minutes ago", avatarSrc: "/samples/ipsum-man.jpg" },
            { id: "3", actor: "Leila Bennani", action: "booked a follow-up", time: "Yesterday" },
          ]}
        />
      </div>
    </DashScope>
  );
}