Prompt Library

Saved prompt templates with blanks you fill in the sentence itself.

PROGet Prompt Library and 168 other Pro components with pro lifetime — Get Pro

Category
AI Agent
Access
Pro
Source
749 lines · one file
States
7 drawn
Added
21 Oct 2026

The decision inside it

A blank remembers, and a repeated blank is one field

Fill {customer} once and every copy updates. Open the template tomorrow and it is already filled from last time, with a Clear. The values stay with your app: they come in through remembered and go out through onRemember.

When to use it

Use Prompt Library for saved prompt templates with blanks ({customer}, {tone: friendly|firm}, {notes:long}) that people fill inside the sentence. Values come back through remembered and onRemember, so storage stays in your app.

Installation

How you get it

Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.

Use Liro's Prompt Library for this.
Install it: npx shadcn@latest add @liro/prompt-library
(the @liro registry is set up in components.json, with LIRO_KEY in .env.local)
Import it from @/components/ui/prompt-library.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.

For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above. Pro components install through the @liro registry with your CLI token: see the Namespaced tab.

Usage

components/prompts.tsx
import { PromptLibrary, type PromptTemplate, type PromptValues } from "@/components/ui/prompt-library";

const templates: PromptTemplate[] = [
  { id: "follow-up", title: "Follow up on a contract", category: "Sales", body: "Write a {tone: friendly|firm} follow-up to {customer} about {contract}." },
];

export function Prompts({ saved, store, insert }: {
  saved: Record<string, PromptValues>;
  store: (id: string, values: PromptValues) => void;
  insert: (text: string) => void;
}) {
  return <PromptLibrary templates={templates} remembered={saved} onRemember={store} onUse={(text) => insert(text)} />;
}

API reference

“Copy prompt” above puts a full brief on your clipboard, install command, dependencies, props, and the mistakes an assistant usually makes with this component.

Props

Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.

TypeNotes
templatesPromptTemplate[] Yes–
rememberedRecord<string, PromptValues> NoLast values per template id.
onRemember(id: string, values: PromptValues) => void NoCalled when a prompt is used, with what to remember for next time.
onUse(text: string, values: PromptValues, template: PromptTemplate) => void | Promise<void> NoMay return a promise.
onSave(template: PromptTemplate) => void | Promise<void> NoNew or edited template. May return a promise. Leave out to hide New and Edit.
onToggleFavourite(id: string, favourite: boolean) => void No–
selectedIdstring NoThe open template. Leave out to let the library keep its own.
defaultSelectedIdstring No–
onSelectedChange(id: string) => void No–

Dependencies

npm packages

clsxframer-motionlucide-reacttailwind-merge

Liro foundations, installed alongside it

liro-themebadgebutton

States

All of them are drawn by the component. None is left for you to design.

  • List
  • Filling
  • Filled from last time
  • Missing blanks
  • Used
  • Editing
  • Use failed

Accessibility

  • Keyboard reachable throughout, in visual order
  • Focus trapped in overlays, Escape closes them
  • Focus returns to whatever opened it
  • Live regions announce what changed, not that something did
  • Honours prefers-reduced-motion

Responsive behavior

  • Sizes to its container, not the viewport
  • Usable from 320px up
  • Pointer-based interaction, so trackpad and touch both work
  • No hover-only affordances

Used in a screenAll screens