DDBS UI
dashboard

Dashboard Parts

DashField, DashStatusPill, DashTabs, DashSearchBox, DashPagination, DashEmpty and DashProgress: the small parts of a data screen.

npx shadcn@latest add https://ui.develop-better-solutions.com/r/dash-parts.json
Dependencies:lucide-react
Fullscreen
On dutyOn leave

Used to route the visit.

1 to 10 of 48
1 / 5

No results

Try a different search or clear the filters.

Usage

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

import { useState } from "react";
import {
  DashEmpty,
  DashField,
  DashPagination,
  DashProgress,
  DashSearchBox,
  DashStatusPill,
  DashTabs,
} from "@dbs/ui";
import { DashScope } from "./_store";

type Tab = "all" | "open" | "done";

export default function DashPartsExample() {
  const [tab, setTab] = useState<Tab>("all");
  const [q, setQ] = useState("");
  const [page, setPage] = useState(1);
  const input = "h-11 w-full rounded-lg border border-[var(--dash-line2)] bg-[var(--dash-panel)] px-3 text-sm outline-none";
  return (
    <div className="w-full max-w-3xl">
      <DashScope minHeight={0}>
        <div className="flex flex-col gap-6 text-sm">
          <DashTabs<Tab>
            value={tab}
            onChange={setTab}
            options={[
              { value: "all", label: "All", count: 24 },
              { value: "open", label: "Open", count: 9 },
              { value: "done", label: "Done", count: 15 },
            ]}
            className="flex gap-1"
            tabClassName="rounded-full px-4 py-1.5"
            activeClassName="bg-[var(--dash-bar)] text-[var(--dash-shell)]"
            idleClassName="text-[var(--dash-muted)] hover:bg-[var(--dash-hover)]"
            countClassName="ml-2 rounded-full px-1.5 text-xs"
            countActiveClassName="bg-black/20"
            countIdleClassName="bg-[var(--dash-green-soft)]"
          />
          <DashSearchBox
            value={q}
            onChange={setQ}
            placeholder="Search patients"
            wrapperClassName="relative max-w-sm"
            inputClassName={`${input} pl-10`}
            iconClassName="absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-[var(--dash-muted)]"
          />
          <div className="flex flex-wrap gap-2">
            <DashStatusPill className="inline-flex items-center gap-1.5 rounded-full bg-[var(--dash-green-soft)] px-3 py-1 text-xs text-[var(--dash-bar)]" dotClassName="h-1.5 w-1.5 rounded-full bg-[var(--dash-bar)]">
              On duty
            </DashStatusPill>
            <DashStatusPill className="inline-flex items-center rounded-full border border-[var(--dash-line2)] px-3 py-1 text-xs text-[var(--dash-muted)]">
              On leave
            </DashStatusPill>
          </div>
          <DashField id="dept" label="Department" hint="Used to route the visit." labelClassName="mb-1.5 block text-xs font-medium" errorClassName="mt-1 text-xs text-[var(--dash-bar)]" hintClassName="mt-1 text-xs text-[var(--dash-muted)]">
            <input id="dept" className={input} defaultValue="Cardiology" />
          </DashField>
          <DashProgress value={68} label="Load" className="h-2 w-full" trackClassName="bg-[var(--dash-green-soft)] rounded-full" />
          <div className="rounded-xl border border-[var(--dash-line)]">
            <DashPagination page={page} pages={5} onPage={setPage} total={48} size={10} />
          </div>
          <DashEmpty title="No results" hint="Try a different search or clear the filters." />
        </div>
      </DashScope>
    </div>
  );
}