DDBS UI
dashboard

AI Chat Card

A fixed-height chat card with suggestion chips, thinking dots, a typed-out reply, a credits counter and an input. Bring your own answer function.

npx shadcn@latest add https://ui.develop-better-solutions.com/r/dash-ai-chat-card.json
Dependencies:lucide-react
Fullscreen

AI Assistant

20 credits remaining

Usage

dash-ai-chat-card-example.tsx
"use client";

import { DashAiChatCard } from "@dbs/ui";
import { DashScope } from "./_store";

const ANSWERS: [RegExp, string][] = [
  [/vital|due/, "Three patients are due for vitals in the next hour: rooms 4, 7 and 12. Room 7 is flagged as critical, so start there."],
  [/hrv|low/, "A low HRV usually points to stress, poor sleep or an acute strain. Repeat the reading after ten minutes of rest, and flag it if it stays low."],
  [/handover|summary/, "Handover: 128 patients, 12 critical, 6 under observation. Two discharges are pending and the next appointment is at 14:20."],
];

const answer = (q: string): string => ANSWERS.find(([re]) => re.test(q.toLowerCase()))?.[1] ?? "I can help with vitals, handovers and schedules. Try one of the suggestions.";

export default function DashAiChatCardExample() {
  return (
    <div className="w-full max-w-sm">
      <DashScope minHeight={0} className="!border-0 !bg-transparent !p-0">
        <DashAiChatCard answer={answer} credits={20} suggestions={["Who is due for vitals?", "Why is my HRV low?", "Handover summary"]} onUpgrade={() => undefined} />
      </DashScope>
    </div>
  );
}