# Stack Trace

> An error card that stays small until you need it: the error, how often it fired and a bar per hour, with the frame that threw on top. A click opens its source with the failing line marked, and the rest of the stack unfolds frame by frame with library frames folded away.

## Spec sheet

| | |
| --- | --- |
| Access | Free: no account, free for commercial use |
| Shelf | Components › Data Display |
| Live preview | https://uibrik.com/components/stack-trace |
| Writes | 1 file into `components/uibrik/stack-trace/` |
| Packages | `@tabler/icons-react`, `motion` (the CLI installs them) |
| Needs | React 19, Tailwind CSS v4, a project set up with `npx shadcn@latest init` |
| Theme | Reads the shadcn tokens and follows class-based dark mode ([theming](https://uibrik.com/docs/theming.md)) |
| Updated | Nov 25, 2026 |

## Add it

```bash
npx shadcn@latest add https://uibrik.com/r/stack-trace.json
```

With the `@uibrik` namespace in `components.json` ([setup](https://uibrik.com/docs/installation.md)): `npx shadcn@latest add @uibrik/stack-trace`.

Can't run commands? https://uibrik.com/components/stack-trace/prompt.txt has every file verbatim, with the setup steps, ready for an assistant to write.

## Render it

Renders as is; every value shown is the default, so delete any line you don't need.

```tsx
import { StackTrace } from "@/components/uibrik/stack-trace/stack-trace";

const message = "Cannot read properties of undefined (reading 'amount')";

const frames = [
  {
    fn: "formatPrice",
    file: "src/lib/money.ts",
    line: 14,
    column: 22,
    source: {
      start: 10,
      lines: [
        "export function formatPrice(item: LineItem) {",
        "  const currency = item.currency ?? \"USD\";",
        "  const fmt = formatter(currency);",
        "",
        "  return fmt.format(item.price.amount / 100);",
        "}",
      ],
    },
  },
  {
    fn: "CartRow",
    file: "src/components/cart/cart-row.tsx",
    line: 31,
    column: 9,
    source: {
      start: 28,
      lines: ["  return (", "    <li className=\"row\">", "      <span>{item.name}</span>", "      <span>{formatPrice(item)}</span>", "    </li>", "  );"],
    },
  },
  // …6 more
];

const events = [3, 2, 4, 2, 1, 2, 3, 5, 4, 6, 8, 12, 9, 7, 14, 22, 31, 26, 18, 12, 9, 11, 7, 5];

<StackTrace
  type="TypeError"
  message={message}
  color="#e5484d"
  eventsLabel="24h"
  defaultOpen={false}
  defaultExpanded={false}
  width={460}
  frames={frames}
  events={events}
  users={214}
  tags={["Chrome 131", "v2.4.1", "checkout"]}
/>
```

## Tune it

The same props as the Customize panel on https://uibrik.com/components/stack-trace.

| Prop | Type | Default | What it does |
| --- | --- | --- | --- |
| `type` | `string` | `"TypeError"` | Error class, shown in the pill. |
| `message` | `string` | `"Cannot read properties of undefined (reading 'amount')"` | The error message. |
| `color` | `string` | `"#e5484d"` | Colour of the error pill, the peak bar and the failing line. |
| `eventsLabel` | `string` | `"24h"` | Span the bars cover. |
| `defaultOpen` | `boolean` | `false` | Show the failing frame's source on mount. |
| `defaultExpanded` | `boolean` | `false` | Show every frame on mount. |
| `width` | `number` | `460` | Width of the card; never wider than its container. |

## Wire it

The props the Customize panel doesn't show: ranges, data, content and callbacks.

| Prop | Type | Default | What it does |
| --- | --- | --- | --- |
| `frames` | `{ fn: string; file: string; line: number; column?: number; inApp?: boolean; source?: { start: number; lines: string[] } }[]` |  | Innermost frame first. Frames with inApp false fold into library rows; frames with source open to show it. |
| `events` | `number[]` |  | Events per bucket, oldest first; drawn as the bars in the header. |
| `users` | `number` | `214` | People affected. |
| `tags` | `string[]` |  | Short facts in the footer, e.g. browser and release. |
| `className` | `string` |  | Classes for the wrapper. |

## Where it fits

- **Error monitoring dashboards**: Each issue reads in one line, and the source is a click away instead of a page away. Pairs with [Uptime Bar](https://uibrik.com/components/uptime-bar.md) (Pro).
- **Developer tool landing pages**: An error that unfolds into its stack and source shows what the product does without a screenshot. Pairs with [Terminal Demo](https://uibrik.com/components/terminal-demo.md) (Pro).
- **Crash reports in admin panels**: Library frames fold away, so the frames from your own code are the ones people read.

## Same shelf: Data Display

- [Strike Todos](https://uibrik.com/components/strike-todos.md): A plain to-do list: checking an item draws a line through it, and unchecking wipes the line away.
- [Swipe Rows](https://uibrik.com/components/swipe-rows.md) (Pro): A list whose rows swipe open to reveal actions, with iOS physics: buttons fan out from under the row, a full swipe runs the edge action and the list closes the gap.
- [Tree View](https://uibrik.com/components/tree-view.md): A file and folder tree with folders that ease open, guide lines, a sliding selection and full tree keyboard control.
- [Bulk Select](https://uibrik.com/components/bulk-select.md) (Pro): A selectable list with a floating action bar: shift-click ticks a range in a wave, the count pill widens into a toolbar, pointing at an action tints the rows it will touch, and archived rows collapse as their avatars fly into the bar.
- [Code Block](https://uibrik.com/components/code-block.md): A code block that shows plain text at once and colours it in place with on-demand Shiki, with tabs that sync across blocks, marked lines, diffs, collapsing and a copy button.
- [Gravity Sort](https://uibrik.com/components/gravity-sort.md) (Pro): A sortable, filterable table whose rows have weight: the order changes at once, and each row moves on a spring of its own mass, the heaviest leaving first and on top, while filtered rows fade where they stand and the rest glide to close the gaps.

## Ground rules

- Only the props above exist. To change anything else, edit the installed file.
- Keep the files in `components/uibrik/stack-trace/` so the import paths keep resolving.
- The playbook for working with the whole library: https://uibrik.com/llms.txt
