Skip to content
Ginga UI
Ginga UI
日本語

Getting started

  • Overview
  • Quick start
  • Theme generation
  • Custom rendering
  • All components

Forms

  • Button
  • Checkbox
  • Input
  • Radio
  • Questionnaire
  • SegmentedControl
  • Select
  • ComboBox
  • NumberField
  • SearchField
  • Slider
  • Switch
  • FormControl

Display

  • Accordion
  • Alert
  • AlertDialog
  • Badge
  • CodeBlock
  • Card
  • Dialog
  • Drawer
  • Image
  • List
  • Popover
  • Menu
  • Tooltip
  • Table
  • Tab
  • Toast
  • Trace

Typography

  • Heading
  • Paragraph

Navigation

  • Anchor

Layout

  • Box

Resources

  • Changelog
  • GitHub (opens in a new tab)

Logo: Twemoji (opens in a new tab) (CC-BY 4.0)

Trace

A list of lines showing the steps an AI agent took, such as reasoning, tool calls, and sources. Lines can show a status and expand to reveal details.

View in Storybook (opens in a new tab)

Installation

import { Trace } from "@ginga-ui/core";

Basic usage

Each TraceLine combines an icon and a title.

Searched for minimumReleaseAgeRead pnpm-workspace.yaml
trace.tsx
trace.module.css
import { Trace, TraceIcon, TraceLine, TraceTitle } from "@ginga-ui/core";
import { FileText, Search } from "lucide-react";
import styles from "./trace.module.css";

export function BasicExample() {
  return (
    <Trace className={styles.trace}>
      <TraceLine>
        <TraceIcon>
          <Search />
        </TraceIcon>
        <TraceTitle>Searched for minimumReleaseAge</TraceTitle>
      </TraceLine>
      <TraceLine>
        <TraceIcon>
          <FileText />
        </TraceIcon>
        <TraceTitle>Read pnpm-workspace.yaml</TraceTitle>
      </TraceLine>
    </Trace>
  );
}

Status

Specify running, error, or pending with status. Write the state in the title as well, since color alone does not convey it.

Ran pnpm --version
Error
Failed to run pnpm install
Running
Updating the lockfile
Pending
Run the tests
trace.tsx
trace.module.css
import { Trace, TraceIcon, TraceLine, TraceTitle } from "@ginga-ui/core";
import { CircleAlert, CircleCheck, CircleDashed, LoaderCircle } from "lucide-react";
import styles from "./trace.module.css";

export function StatusExample() {
  return (
    <Trace className={styles.trace}>
      <TraceLine>
        <TraceIcon>
          <CircleCheck />
        </TraceIcon>
        <TraceTitle>Ran pnpm --version</TraceTitle>
      </TraceLine>
      <TraceLine status="error">
        <TraceIcon>
          <CircleAlert />
        </TraceIcon>
        <TraceTitle>Failed to run pnpm install</TraceTitle>
      </TraceLine>
      <TraceLine status="running">
        <TraceIcon>
          <LoaderCircle />
        </TraceIcon>
        <TraceTitle>Updating the lockfile</TraceTitle>
      </TraceLine>
      <TraceLine status="pending">
        <TraceIcon>
          <CircleDashed />
        </TraceIcon>
        <TraceTitle>Run the tests</TraceTitle>
      </TraceLine>
    </Trace>
  );
}

Expandable lines

Wrap a line in TraceCollapsible to show details such as command output.

package.json | 2 +- (1 file changed)
pnpm install documentationHow lockfiles work
trace.tsx
trace.module.css
import { Trace, TraceCollapsible, TraceCollapsibleContent, TraceCollapsibleTrigger, TraceDescription, TraceIcon, TraceLine, TraceTitle } from "@ginga-ui/core";
import { ChevronRight, Search, Terminal } from "lucide-react";
import styles from "./trace.module.css";

export function CollapsibleExample() {
  return (
    <Trace className={styles.trace}>
      <TraceCollapsible defaultExpanded>
        <TraceCollapsibleTrigger icon={<ChevronRight />}>
          <TraceLine>
            <TraceIcon>
              <Terminal />
            </TraceIcon>
            <TraceTitle>Ran git diff --stat</TraceTitle>
            <TraceDescription>+2 -1</TraceDescription>
          </TraceLine>
        </TraceCollapsibleTrigger>
        <TraceCollapsibleContent>
          package.json | 2 +- (1 file changed)
        </TraceCollapsibleContent>
      </TraceCollapsible>
      <TraceCollapsible>
        <TraceCollapsibleTrigger icon={<ChevronRight />}>
          <TraceLine>
            <TraceIcon>
              <Search />
            </TraceIcon>
            <TraceTitle>Used 2 sources</TraceTitle>
          </TraceLine>
        </TraceCollapsibleTrigger>
        <TraceCollapsibleContent>
          <TraceLine>
            <TraceTitle>pnpm install documentation</TraceTitle>
          </TraceLine>
          <TraceLine>
            <TraceTitle>How lockfiles work</TraceTitle>
          </TraceLine>
        </TraceCollapsibleContent>
      </TraceCollapsible>
    </Trace>
  );
}

Links

Wrap a TraceLine in a link to make it navigate.

Read the pnpm documentation
trace.tsx
trace.module.css
import { Trace, TraceIcon, TraceLine, TraceTitle } from "@ginga-ui/core";
import { ArrowUpRight } from "lucide-react";
import styles from "./trace.module.css";

export function LinkExample() {
  return (
    <Trace className={styles.trace}>
      <a
        href="https://pnpm.io/"
        target="_blank"
        rel="noreferrer"
        aria-label="Read the pnpm documentation (opens in a new tab)"
      >
        <TraceLine>
          <TraceTitle>Read the pnpm documentation</TraceTitle>
          <TraceIcon>
            <ArrowUpRight />
          </TraceIcon>
        </TraceLine>
      </a>
    </Trace>
  );
}

Props

Trace

NameTypeDefaultDescription
render(props) => ReactElement-Replaces the root element. Return an element that receives the given props, such as next/link.

Also accepts the attributes of the HTML div (opens in a new tab) element.

TraceLine

NameTypeDefaultDescription
status"complete" | "running" | "error" | "pending"-Status of the step. It is read out to screen readers along with the line.
statusLabelstring-Text read out for the status. By default, a label for the current locale is used.
render(props) => ReactElement-Replaces the root element. Return an element that receives the given props, such as next/link.

Also accepts the attributes of the HTML span (opens in a new tab) element.

TraceIcon

NameTypeDefaultDescription
render(props) => ReactElement-Replaces the root element. Return an element that receives the given props, such as next/link.

Also accepts the attributes of the HTML span (opens in a new tab) element.

TraceTitle

NameTypeDefaultDescription
render(props) => ReactElement-Replaces the root element. Return an element that receives the given props, such as next/link.

Also accepts the attributes of the HTML span (opens in a new tab) element.

TraceDescription

NameTypeDefaultDescription
render(props) => ReactElement-Replaces the root element. Return an element that receives the given props, such as next/link.

Also accepts the attributes of the HTML span (opens in a new tab) element.

TraceCollapsible

NameTypeDefaultDescription
expandedboolean-Whether the details are expanded (controlled). Use it with onExpandedChange.
disabledbooleanfalseDisables expanding.

Also accepts the props of React Aria's Disclosure (opens in a new tab).

TraceCollapsibleTrigger

NameTypeDefaultDescription
iconReactNode-Icon shown at the end of the trigger. It rotates when expanded.
disabledbooleanfalseDisables the trigger.

Also accepts the props of React Aria's Button (opens in a new tab).

TraceCollapsibleContent

Accepts the props of React Aria's DisclosurePanel (opens in a new tab).