Componentdata
Table Summary
Table footer summary rows with bolded totals in dashed frame.
Preview
Live Preview
Summary
- Subtotal
- $90
- Total
- $108
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add table-summaryOr install the full npm package:
npm install bigbulluiUsage
import { TableSummary } from "@/components/ui/table-summary";
<TableSummary />Source code
table-summary.tsxZero dependencies (only React + utils). Copy and paste directly into your project:
"use client";
import * as React from "react";
import { cn } from "./lib/utils";
export interface SummaryRow {
id: string;
label: string;
value: string;
/** kalın vurgulu toplam satırı */
bold?: boolean;
}
export interface TableSummaryProps extends React.HTMLAttributes<HTMLDivElement> {
rows: SummaryRow[];
caption?: string;
}
/** Tablo altı özet: satırlar + kalın toplam + dash çerçeve. */
export function TableSummary({ rows, caption, className, ...props }: TableSummaryProps) {
return (
<div className={cn("w-full max-w-sm rounded-lg border-2 border-dashed border-border bg-card p-4", className)} {...props}>
<style>{`@keyframes tsIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }`}</style>
{caption && <p className="mb-2 font-mono text-[10px] uppercase tracking-[0.15em] text-muted-foreground">{caption}</p>}
<dl className="space-y-1.5">
{rows.map((row, idx) => (
<div
key={row.id}
className={cn(
"flex items-center justify-between gap-4 animate-[tsIn_0.3s_ease-out_both] motion-reduce:animate-none",
row.bold && "border-t border-dashed border-border pt-2"
)}
style={{ animationDelay: `${idx * 50}ms` }}
>
<dt className={cn("text-sm", row.bold ? "font-semibold text-foreground" : "text-muted-foreground")}>{row.label}</dt>
<dd className={cn("font-mono text-sm tabular-nums", row.bold ? "font-bold text-accent" : "text-foreground")}>{row.value}</dd>
</div>
))}
</dl>
</div>
);
}
Props
| Prop | Type | Description |
|---|---|---|
| rows | SummaryRow[] | |
| caption | string |