Primitive Run Card Components
retab-ui/primitive-run-cardsFreeComponent
Prop-driven run cards for each Retab primitive — classify, split, partition, parse, and extract — each framing the source document with that primitive's result over the shared RunCard shell. Presentational: pass the resolved result (category, segments, markdown, or extract fields), so the same cards render a static demo or a live workflow run's per-block result.
Install it
npx shadcn@latest add https://ui.retab.com/r/primitive-run-cards.jsonSource
1"use client";23import type React from "react";4import ReactMarkdown, { type Components } from "react-markdown";5import remarkGfm from "remark-gfm";67import {8 SEGMENT_PALETTE,9 segmentsPageCount,10 type Segment,11} from "@/lib/segments";12import { FileThumbnail } from "@/components/ui/file-thumbnail";13import { PageRibbon, type RibbonRow } from "@/components/ui/page-ribbon";14import { RunCard, type RunStatus } from "@/components/ui/run-card";15import { SegmentLegend } from "@/components/ui/segment-legend";16import type { Source, SourceAnchor } from "@/lib/document-source";1718/**19 * Prop-driven primitive run cards — one card per Retab primitive (classify,20 * split, partition, parse, extract), each framing the source document with that21 * primitive's result over the shared {@link RunCard} shell. Presentational: the22 * caller resolves the result (a category, `Segment[]`, markdown, or extract23 * fields) and passes it in, so the same cards render a static demo or a live24 * workflow run's per-block result.25 */2627// The sample pages are US-Letter; one page aspect lets coordinate-anchored28// overlays (the extract source boxes) map onto the cropped thumbnail.29const PAGE_ASPECT = 800 / 1036;3031export type PrimitiveRunCardFile = { name: string; type: string };3233interface PrimitiveRunCardBase {34 /** Source document the run was over. */35 file: PrimitiveRunCardFile;36 /** Run lifecycle pill; defaults to "completed". */37 status?: RunStatus | null;38 /** Makes the whole card a button. */39 onClick?: () => void;40}4142// ── Classification ────────────────────────────────────────────────────────────4344export interface ClassificationRunCardProps extends PrimitiveRunCardBase {45 /** Page image rendered behind the result. */46 previewImageUrl?: string;47 /**48 * Custom media rendered in the shared RunCard frame. Use this when a consumer49 * owns document loading/cropping behavior but still wants the shared50 * classification footer and run-card shell.51 */52 media?: React.ReactNode;53 /** Aspect ratio for custom media; defaults to the RunCard media frame. */54 mediaAspectRatio?: number;55 category: string;56 reasoning?: string;57}5859export function ClassificationRunCard({60 file,61 previewImageUrl,62 media,63 mediaAspectRatio,64 category,65 reasoning,66 status = "completed",67 onClick,68}: ClassificationRunCardProps) {69// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from retab-ui
All 130 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Alertalert | retab-ui | Components | Free | 1 dep | |
| Alert Dialogalert-dialog | retab-ui | Components | Free | 1 dep | |
| Aspect Ratioaspect-ratio | retab-ui | Components | Free | no deps | |
| Attachment Sidebarattachment-sidebar | retab-ui | Components | Free | 1 dep | |
| Autocompleteautocomplete | retab-ui | Components | Free | 2 deps | |
| Calendarcalendar | retab-ui | Components | Free | 2 deps | |
| Code Viewercode-viewer | retab-ui | Components | Free | 2 deps · 32 files | |
| Commandcommand | retab-ui | Components | Free | 2 deps |
