Result Card
Shows something an agent made or did in chat. It names the apps used, shows a live status, and offers one action, such as opening the result in a canvas. ResultAppActions lists what each app did.
Installation
pnpm dlx shadcn@latest add https://sprout.tulipfarm.ai/r/result-card.jsonCopies Result Card and the components it uses (Brand Icon, Button, Popover, and Spinner) into your app, installs the packages, and adds the styles. Then import it from @/components/ui/result-card. Needs Tailwind CSS 4 and a components.json from shadcn init.
Install the following dependencies:
pnpm add clsx tailwind-merge @hugeicons/core-free-icons @hugeicons/reactAdd Sprout base once per app: the
cn()helper and the design tokens.lib/sprout/classes.ts- Design tokens, for your global CSS
Add the components it uses: Brand Icon, Button, Popover, and Spinner.
Copy and paste the following code into your project.
'use client'; import type { ComponentProps, ReactNode } from 'react'; import { CheckIcon } from '@/lib/sprout/icons/check-icon'; import { DangerIcon } from '@/lib/sprout/icons/danger-icon'; import { PlugIcon } from '@/lib/sprout/icons/plug-icon'; import { cn } from '@/lib/sprout/classes'; import { BrandIcon, BrandTile, type Brand } from '@/components/ui/brand-icon'; import { Button } from '@/components/ui/button'; import { Popover, PopoverContent, PopoverTitle, PopoverTrigger } from '@/components/ui/popover'; import { Spinner } from '@/components/ui/spinner'; export const resultCardKindNames = [ 'File', 'Plan', 'Workflow', 'Action', 'Calendar', 'Table', 'Activity', 'Agent', 'Skill', ] as const; export const resultCardStateNames = ['default', 'loading', 'running', 'disabled', 'error', 'success'] as const; export const resultAppActionStateNames = [ 'completed', 'pending', 'running', 'failed', 'unknown', 'blocked', 'cancelled', 'skipped', ] as const; export type ResultCardKind = (typeof resultCardKindNames)[number]; export type ResultCardState = (typeof resultCardStateNames)[number]; export type ResultAppActionState = (typeof resultAppActionStateNames)[number]; export type ResultAppAction = { label: string; state: ResultAppActionState }; export type ResultApp = { brand: Brand | null; name: string; icon?: ReactNode; actions: readonly ResultAppAction[]; }; export type ResultCardAction = { label: string; onClick: () => void; disabled?: boolean | undefined; }; export interface ResultCardProps extends Omit<ComponentProps<'section'>, 'title' | 'children'> { title: string; kind: ResultCardKind; apps: readonly ResultApp[]; status: string; state?: ResultCardState | undefined; action?: ResultCardAction | undefined; icon?: ReactNode; children?: ReactNode; } const actionPrefixes: Record<Exclude<ResultAppActionState, 'completed'>, string> = { failed: 'Failed:', unknown: 'Unconfirmed:', pending: 'Pending:', running: 'In progress:', blocked: 'Blocked:', cancelled: 'Cancelled:', skipped: 'Skipped:', }; function mergeApps(apps: readonly ResultApp[]) { const byKey = new Map<string, ResultApp>(); for (const app of apps) { const key = app.brand ?? app.name; const existing = byKey.get(key); byKey.set(key, existing ? { ...existing, actions: [...existing.actions, ...app.actions] } : app); } return [...byKey.values()]; } export function ResultCard({ title, kind, apps, status, state = 'default', action, icon, children, className, ...props }: ResultCardProps) { const unique = mergeApps(apps); const visible = unique.slice(0, 2); const hidden = unique.slice(2); const busy = state === 'loading' || state === 'running'; const disabled = state === 'disabled'; return ( <section data-slot="result-card" data-state={state} data-kind={kind} aria-label={`${kind}: ${title}`} aria-busy={busy} {...props} className={cn('sprout-result-card', className)} > <div className="sprout-result-card-header"> {visible.length > 0 ? ( <div role="group" aria-label="Apps used" className="sprout-result-card-apps"> {visible.map(app => ( <span key={app.brand ?? app.name} data-result-app={app.brand ?? 'connected-app'} className="sprout-result-card-app" > <AppActionsPopover apps={[app]} disabled={disabled} /> </span> ))} {hidden.length > 0 && ( <span data-result-overflow={hidden.length} className="sprout-result-card-app"> <AppActionsPopover apps={hidden} overflow disabled={disabled} /> </span> )} </div> ) : ( icon && ( <BrandTile aria-hidden="true" className="sprout-result-card-icon"> {icon} </BrandTile> ) )} <div className="sprout-result-card-main"> <div className="sprout-result-card-text"> <h3 className="sprout-result-card-title">{title}</h3> <div className="sprout-result-card-meta"> <span>{kind}</span> <span aria-hidden="true">·</span> <span role="status" data-tone={state === 'success' || state === 'error' ? state : undefined} className="sprout-result-card-status" > {busy ? ( <Spinner aria-hidden="true" /> ) : state === 'success' ? ( <CheckIcon size="sm" aria-hidden="true" /> ) : state === 'error' ? ( <DangerIcon size="sm" aria-hidden="true" /> ) : null} {status} </span> </div> </div> {action && ( <div className="sprout-result-card-action"> <Button variant="outline" disabled={state === 'loading' || disabled || action.disabled === true} onClick={action.onClick} > {action.label} </Button> </div> )} </div> </div> {children && <div className="sprout-result-card-body">{children}</div>} </section> ); } function AppActionsPopover({ apps, overflow = false, disabled, }: { apps: readonly ResultApp[]; overflow?: boolean; disabled: boolean; }) { const first = apps[0]; if (!first) return null; const title = overflow ? `${apps.length} more ${apps.length === 1 ? 'app' : 'apps'}` : `${first.name} actions`; return ( <Popover> <PopoverTrigger openOnHover delay={800} closeDelay={200} render={<BrandTile size="action" render={<Button variant="ghost" size="icon" disabled={disabled} />} />} aria-label={title} > {overflow ? ( <span className="sprout-result-card-overflow">+{apps.length}</span> ) : first.brand ? ( <BrandIcon brand={first.brand} size="fill" /> ) : first.icon ? ( <span aria-hidden="true" className="sprout-result-app-icon"> {first.icon} </span> ) : ( <PlugIcon size="lg" aria-hidden="true" /> )} </PopoverTrigger> <PopoverContent size="app-actions" align="start" sideOffset={8} initialFocus={interaction => interaction !== 'mouse'} > <PopoverTitle>{title}</PopoverTitle> <ResultAppActions apps={apps} showAppNames={overflow} /> </PopoverContent> </Popover> ); } export interface ResultAppActionsProps extends Omit<ComponentProps<'div'>, 'children'> { apps: readonly ResultApp[]; showAppNames?: boolean | undefined; } export function ResultAppActions({ apps, showAppNames = true, className, ...props }: ResultAppActionsProps) { return ( <div data-slot="result-app-actions" {...props} className={cn('sprout-result-app-actions', className)}> {apps.map(app => ( <section key={app.brand ?? app.name} aria-label={app.name} className="sprout-result-app"> {showAppNames && ( <div className="sprout-result-app-name"> {app.brand ? ( <BrandIcon brand={app.brand} size="glyph" /> ) : app.icon ? ( <span aria-hidden="true" className="sprout-result-app-icon"> {app.icon} </span> ) : ( <PlugIcon size="xl" aria-hidden="true" /> )} <h4>{app.name}</h4> </div> )} {app.actions.length === 0 ? ( <p className="sprout-result-app-empty">No action details were recorded.</p> ) : ( <ul className="sprout-result-app-list"> {app.actions.map((action, index) => ( <li key={`${action.label}:${index}`} data-state={action.state} className="sprout-result-app-action"> {action.state === 'completed' ? ( <span className="sprout-result-app-check"> <CheckIcon size="md" aria-hidden="true" /> <span className="sprout-result-sr-only">Completed:</span> </span> ) : ( <span className="sprout-result-app-prefix">{actionPrefixes[action.state]}</span> )} <span className="sprout-result-app-label">{action.label}</span> </li> ))} </ul> )} </section> ))} </div> ); }And the files it imports:
lib/sprout/icons/check-icon.tsxlib/sprout/icons/create-icon.tsxlib/sprout/icons/danger-icon.tsxlib/sprout/icons/plug-icon.tsx
Add the styles to your global CSS, after
@import "tailwindcss".@layer components { .sprout-result-card { box-sizing: border-box; border: 1px solid var(--sprout-input); border-radius: var(--sprout-radius-panel); background: var(--sprout-surface); min-width: 0; color: var(--sprout-text); font-family: var(--sprout-font); --sprout-brand-ring: var(--sprout-surface); container-type: inline-size; } .sprout-result-card-header { align-items: flex-start; gap: 12px; padding: 16px; display: flex; } .sprout-result-card-apps { isolation: isolate; flex-shrink: 0; align-items: center; display: flex; } .sprout-result-card-app { box-shadow: 0 0 0 2px var(--sprout-surface); border-radius: .5rem; flex-shrink: 0; display: inline-flex; position: relative; } .sprout-result-card-app + .sprout-result-card-app { margin-inline-start: -6px; } .sprout-result-card-app:hover, .sprout-result-card-app:focus-within { z-index: 10; } .sprout-result-card-overflow { font-size: var(--sprout-text-xs); font-variant-numeric: tabular-nums; font-weight: 500; } .sprout-result-card-icon[data-size] { color: var(--sprout-text); } .sprout-result-card-icon > svg { width: 18px; height: 18px; } .sprout-result-card-main { flex-direction: column; flex: 1; gap: 12px; min-width: 0; display: flex; } .sprout-result-card-text { flex-direction: column; flex: auto; gap: 6px; min-width: 0; display: flex; } .sprout-result-card-title { color: var(--sprout-text); font-size: var(--sprout-text-base); overflow-wrap: anywhere; margin: 0; font-weight: 500; line-height: 1.5rem; } .sprout-result-card-meta { color: var(--sprout-muted); font-size: var(--sprout-text-sm); flex-wrap: wrap; align-items: center; gap: 4px 8px; line-height: 1.25rem; display: flex; } .sprout-result-card-status { overflow-wrap: anywhere; min-width: 0; transition: color var(--sprout-motion-normal) var(--sprout-motion-ease); align-items: center; gap: 6px; display: inline-flex; } .sprout-result-card-status > svg { flex-shrink: 0; } .sprout-result-card-status[data-tone="success"] { color: var(--sprout-success); } .sprout-result-card-status[data-tone="error"] { color: var(--sprout-danger); } .sprout-result-card-action { flex-shrink: 0; align-self: flex-start; } .sprout-result-card-body { font-size: var(--sprout-text-sm); flex-direction: column; gap: 12px; padding: 0 16px 16px; display: flex; } .sprout-result-card-body :where(p) { margin: 0; } @container (width >= 28rem) { .sprout-result-card-main { flex-direction: row; justify-content: space-between; align-items: center; } .sprout-result-card-action { align-self: center; } } @media (pointer: coarse) { .sprout-result-card-app + .sprout-result-card-app { margin-inline-start: -8px; } .sprout-result-card-action .sprout-button { height: 44px; } } .sprout-result-app-actions { font-family: var(--sprout-font); color: var(--sprout-text); flex-direction: column; gap: 16px; display: flex; } .sprout-result-app { flex-direction: column; gap: 8px; min-width: 0; display: flex; } .sprout-result-app-name { align-items: center; gap: 8px; display: flex; } .sprout-result-app-name > svg { flex-shrink: 0; } .sprout-result-app-icon { flex-shrink: 0; width: 18px; height: 18px; display: inline-flex; } .sprout-result-app-name > .sprout-result-app-icon { width: 20px; height: 20px; } .sprout-result-app-icon > svg { width: 100%; height: 100%; } .sprout-result-app-name h4 { color: var(--sprout-text); font-size: var(--sprout-text-sm); margin: 0; font-weight: 500; line-height: 1.25rem; } .sprout-result-app-empty { color: var(--sprout-muted); font-size: var(--sprout-text-sm); margin: 0; line-height: 1.25rem; } .sprout-result-app-list { flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; display: flex; } .sprout-result-app-action { font-size: var(--sprout-text-sm); align-items: flex-start; gap: 8px; line-height: 1.25rem; display: flex; } .sprout-result-app-check { color: var(--sprout-success); flex-shrink: 0; margin-top: 2px; display: inline-flex; } .sprout-result-app-prefix { color: var(--sprout-muted); flex-shrink: 0; } .sprout-result-app-action[data-state="failed"] .sprout-result-app-prefix { color: var(--sprout-danger); } .sprout-result-app-label { overflow-wrap: anywhere; min-width: 0; } .sprout-result-sr-only { clip: rect(0 0 0 0); white-space: nowrap; border: 0; width: 1px; height: 1px; margin: -1px; padding: 0; position: absolute; overflow: hidden; } @media (prefers-reduced-motion: reduce) { .sprout-result-card-status { transition: none; } } }Import it from
@/components/ui/result-card. Update the paths if your@/alias points elsewhere.
pnpm add @tulipfarm/sprout@import "tailwindcss";
@import "@tulipfarm/sprout/styles.css";The package keeps the source and ships fixes with each release. Import from @tulipfarm/sprout/result-card.
Investor pitch
Local sample. Nothing is opened or sent.
Usage
import { ResultCard } from "@tulipfarm/sprout/result-card";
<ResultCard
title="Investor pitch"
kind="File"
status="Saved in Google Slides"
state="success"
apps={[
{
brand: "google-slides",
name: "Google Slides",
actions: [
{ label: "Created the investor pitch presentation", state: "completed" },
{ label: "Added the two pitch slides", state: "completed" },
],
},
]}
action={{ label: "View slides", onClick: openInCanvas }}
/>kind:"File","Plan","Workflow","Action","Calendar","Table","Activity","Agent", or"Skill". It shows before the status and names the card “Kind: title”.status: short text, such as “Waiting for review” or “Action not confirmed”.action: one outline button. It sits beside the text when the card is at least 28rem wide, and below it when narrower. Passdisabledto turn it off.icon: shown in a tile whenappsis empty, such as a file, table, plan, or workflow icon.children: extra content under the header, such as plan progress and controls.
States
Default
Investor pitch
Loading
Investor pitch
Running
Investor pitch
Unavailable
Investor pitch
Error
Investor pitch
Success
Investor pitch
Local sample. Nothing is opened or sent.
"default": a muted status."loading": a spinner andaria-busy; the action is disabled while the card checks."running": a spinner andaria-busy; the action stays available."disabled": the action and app tiles are disabled."error": a red status with a warning icon."success": a green status with a check.
Apps used
One app
Investor pitch
Two apps
Prepare the investor update
Five apps fold into +3
Weekly team update
Repeated app merges into one tile
Supplier follow-up
Apps without a brand
Ticket triage
App with its own icon
Pipeline review
No recorded actions
GitHub changes
No apps, icon tile
Supplier price sheet.xlsx
No apps, no icon, no action
Quarterly planning notes with a long title that wraps onto a second line in narrow chats
Local sample. Nothing is opened or sent.
Each app is a tile. Entries with the same brand (or the same name when brand is null) merge into one tile. Two tiles show; the rest fold into a “+N” tile. A tile opens its actions after 800ms of hover, or on click, Enter, or Space. An app with brand: null shows its icon, such as a table icon for your own data, or a plug when it has none.
Actions by app
Actions by app
Google Slides
- Completed:Created the investor pitch presentation
- Pending:Send the investor update email
- In progress:Saving the weekly update document
- Failed:Post to #investors
Google Sheets
- Unconfirmed:Append rows to Q4 forecast
- Blocked:Reply in the supplier thread
- Cancelled:Delete the draft event
- Skipped:Notify the on-call channel
Connected apps
No action details were recorded.
Slack actions
- Completed:Posted the weekly update
- Pending:Reply to a thread
import { ResultAppActions } from "@tulipfarm/sprout/result-card";
<h3>Actions by app</h3>
<ResultAppActions apps={result.apps} />
// One app, without its name above the list
<ResultAppActions apps={[slackApp]} showAppNames={false} />A check marks "completed". Other states are spelled out: “Pending:”, “In progress:”, “Failed:” (red), “Unconfirmed:”, “Blocked:”, “Cancelled:”, and “Skipped:”. An app with no actions says “No action details were recorded.”
In TulipFarm
Each sample below uses local data shaped like a TulipFarm screen. Pick an outcome to see how its status, state, and app actions change.
Chat card
Slack reply
Review canvas, no action
Slack reply
Local sample. Nothing is opened or sent.
Create issue on Acme Jira
Recorded activity
Calendar read · 3 events
Calendar result unavailable
Local sample. Nothing is opened or sent.
Price comparison.xlsx
Local sample. Nothing is opened or sent.
GitHub changes
Local sample. Nothing is opened or sent.
Prepare the board summary
Local sample. Nothing is opened or sent.
Supplier contacts
Supplier contacts
Local sample. Nothing is opened or sent.
1 app
Investor pitch
2 apps
Prepare the investor update
5 apps
Weekly team update
Weekly team update
Weekly team update
Weekly team update
Local sample. Nothing is opened or sent.
Investor pitch
Local sample. Nothing is opened or sent.
Weekly team update
Accessibility
The card is a section named “Kind: title”, with the title as anh3. The status is a live status, so changes are announced. Busy cards set aria-busy. App tiles sit in a group named “Apps used”; each is a button named “Slack actions” or “3 more apps”. Opening one by keyboard moves focus into the panel; Escape closes it and returns focus. Icons are hidden from assistive tech, and completed actions read “Completed:”.
On touch screens the action button and tiles grow to 44px. Status colors fade in 180ms; with reduced motion the fade and spinner stop.
Theme tokens
The card uses --sprout-surface,--sprout-input for its border, --sprout-muted,--sprout-success, and --sprout-danger. App tiles use the Brand Icon tokens.