Skip to content

Prompt Templates

Saved prompts you fill in place. Pick one from a searchable list and it reads as a sentence with its variables as fields inside the text; Tab moves between them. A count says what's left, the assembled prompt updates as you type, with a token estimate, Copy and Use prompt.

On this page

Examples

Ready to use

Installation

Installation is part of Pro

Pro components install from a licensed registry. The live preview stays open to everyone.

Props

templates
{ id, title, body, tag?, description? }[]
Body syntax: {name} required, {name?} optional (dropped when empty), {name:a|b|c} one of a list, {name?:a|b}. {{ and }} are literal braces. Underscores and dashes in names read as spaces in the field.
selected / defaultSelected / onSelectedChange
string / string / (id) => void
Defaultthe first
Which template is open.
values / defaultValues / onValuesChange
Record<id, Record<name, string>>
Default{}
What's typed, per template, so switching templates keeps each one's fields.
onUse / useLabel
(text, values, template) => void / ReactNode
Default - / "Use prompt"
Use prompt: enabled once every required field is filled; before that, its tooltip says what's missing and a click moves focus to the first empty field. Ctrl or Cmd + Enter in a field does the same.
onCopy
(text) => void
Called after Copy puts the assembled prompt on the clipboard.
estimateTokens
(text) => number
Defaultabout 4 chars a token
Plug in your tokenizer; the count is shown with a ~.
emptyText
ReactNode
Default"No templates match."
Shown when the search finds nothing.
a11y
labelled fields, list keys
Each field is labelled with its variable name (and optional). Up and Down move through the list. The count is announced politely. One-of fields and, under about 670px wide, the template list open our Menu as a listbox: arrows, typeahead, Enter, and Tab moves on to the next field. Optional one-of fields offer None. Punctuation after a field stays on its line.
frame
boolean
Defaulttrue
The card's border and radius. false renders flush, for a panel that has its own, like the composer panel above.
headingLevel
2 | 3 | 4 | 5 | 6
Default3
Level of the open template's title heading, so it fits your page's outline (the example above uses 2, right under the page title).

When to use

When to use

  • A library of saved prompts people reuse: pick one, fill in the blanks inside the sentence, send it.
  • Teams sharing tested prompts, where a few variables (product, version, audience) change each time.
  • Feeding a chat composer: Use prompt hands it the filled text once every required field is in.

When not to use

  • Writing a free-form prompt from scratch: use Chat Composer.
  • Suggesting the rest of a sentence as people type: use Ghost Text.

Using with AI

Use Copy page for AI above to give your assistant this page, Copy prompt under the install command to have it installed and wired to your data, or connect the Knowns UI MCP server and just ask:

  • Add the Knowns UI Prompt Templates to my app and wire it to my own data.
  • I need a library of saved prompts people reuse: pick one, fill in the blanks inside the sentence, send it. Set that up with the Knowns UI Prompt Templates.
  • Which Prompt Templates props do I need for a minimal setup? Show me a short example.

With the server connected, your assistant calls get_component({ name: "prompt-templates" }) and search_docs({ query: "prompt templates" }). Pro props, full examples and source come back once your license key is in the MCP config.

Need help?

Stuck on Prompt Templates, or found something off? We read every message.