Ballmac UI home

Prompt Library

New

A shelf of saved prompts: search, filter by tag, pin favourites, and fill in the {{variables}} with labelled fields while a preview shows the finished text. Insert names anything missing; Copy puts it on the clipboard.

v1.0.0Updated Oct 25, 2026Ships with a test
What changed

Team prompts

Pick a prompt to fill it in.

Installation

$ pnpm dlx shadcn@latest add @ballmac/prompt-library

Usage

import { PromptLibrary, extractVariables, fillPrompt } from "@/components/ballmac/prompt-library"

The full example is in the Code tab above.

Examples

A short shelf

Starters

Pick a prompt to fill it in.

API reference

PropTypeDefault
prompts*LibraryPrompt[]—
titlestring—
onInsert

Called with the finished prompt text. Reject and the card says why.

(text: string, prompt: LibraryPrompt) => void | Promise<void>—
onFavourite

Called when a prompt is pinned or unpinned. Reject and it goes back with the message.

(id: string, favourite: boolean) => void | Promise<void>—

Also accepts the standard attributes of its root element.

Accessibility

KeyAction
Search and tagsA labelled search box; tags are toggle buttons with pressed state
ListA list of buttons with pressed state; pinning is a separate toggle button named 'Pin <title>'
VariablesEvery variable gets a labelled field (underscores become spaces); an unfilled one is also shown dashed in the preview as {{name}}
InsertRefused with an alert that names what is missing, and the empty fields are marked invalid
Results'Inserted: …' and 'Copied' are announced politely; failures are alerts

Use with AI

prompts is [{ id, title, body, description?, tags?, favourite? }] (required); put {{variable}} in body where a person fills something in. title. onInsert(text, prompt) gets the finished text and may be async (reject and the card says why); onFavourite(id, favourite) pins or unpins (shown at once, put back with the reason if it rejects). Insert is refused with 'Fill in: …' naming what is missing. Exports extractVariables and fillPrompt. With the shadcn MCP server set up (guide), ask your agent:

Add the Ballmac UI Prompt Library (@ballmac/prompt-library) to this project with the shadcn MCP, then use it where it fits.

Use it for

  • A set of reusable prompts a team shares, with blanks to fill in
  • The panel next to a chat composer that inserts a prepared prompt

Not for

  • Recent conversations; use a list of chats
  • Comparing two versions of a prompt; use prompt-diff

Registry JSON: https://ui.ballmac.com/r/prompt-library.json

Credits

Free to use in personal and commercial projects.

Ballmac UI Pro

Need the whole screen, not one piece?

150 premium blocks (dashboards, settings, calendars, mail, shops, onboarding), a private shadcn registry and Figma tokens. Blocks that show data come with loading, empty and error states built in.

Not ready? Try three Pro blocks free

Leave your email and the blocks appear right here, ready to copy. Yours to use in any project.