Skip to content
ghostui

Preview

Installation

Install

Basic usage

Snippet owns the value and copy feedback. The caller owns its label, content and surrounding layout.

Structures

A headed snippet places its title and optional source tabs in one header. That header and the value share one secondary surface, with a divider below the header. Without a heading or source tabs, the value stays a single surface. Inline snippets remain transparent.

Examples

Basic value

Use the basic variant for a short command or value.

Block code

Use the block variant when the value needs a padded code surface.

Inline command

Place an inline snippet inside a sentence. Its copy action appears on hover or focus.

Run npm run typecheck before opening a pull request.

Text with a heading

Use contentType="text" for caller-owned prose. A title creates the headed surface and divider.

Release note

Header without a divider

Set headerSeparator={false} when the heading and value share a surface without a divider.

Deployment

Long content

Set collapsible to disclose a long value. The default collapseMode="truncate" keeps a line-limited body and offers Show more when the value exceeds initialLines.

Response payload

Hidden source

Set collapseMode="hide" with collapsible to keep source hidden until requested. The headed action area shows View Code while closed and Copy while open. Copy is disabled for an empty source.

Deploy preview

Source choices

Use sources for alternate values. Tabs keep the active source and copy action together.

API request

Empty value

An empty source shows its empty message and disables Copy.

No source

Accessibility

Source choices use Tabs keyboard behavior. Disclosure exposes aria-expanded and aria-controls; copy feedback uses a live status. Empty and disabled values cannot be copied. A rejected copy handler shows an error message.

API reference

SnippetSource accepts id, label, and value, with optional language, icon, filename, copy feedback labels, and emptyLabel.