A prompt someone hands to their coding agent. The first lines show, the rest folds away; Copy prompt copies it and Open in starts a new chat in Claude, ChatGPT or Cursor with it filled in. Give it a second prompt with a key in it and it offers Safe or Include my key, while the links always stay safe.
On this page
- Set up with AI
- A docs page as a prompt
- An install guide
- An onboarding step
- A support answer
Examples
Your own apps
Too long for a link
Installation
npx knowns-ui@latest add open-in-aiPaste this into your coding agent (Claude Code, Cursor, Codex). It checks your project, sets up the registry, runs the install and verifies it.
Install Open in AI from Knowns UI into this project. Work step by step, show me each change, and ask before you edit files outside this project.
Context: Knowns UI (https://ui.knowns.dev) is a shadcn registry. Items land in the project as source files. Docs: https://ui.knowns.dev/docs/open-in-ai
1. Check the project first. Stop and tell me if any of these is missing:
- React 19 and Tailwind CSS v4.
- A components.json at the project root. If there is none, ask me before running `npx knowns-ui@latest init --no-key` (it runs shadcn init when needed, then adds the registries).
2. Run:
```bash
npx knowns-ui@latest add open-in-ai
```
It writes these files:
- lib/knowns/run.ts
- lib/knowns/json.tsx
- lib/knowns/status.ts
- lib/knowns/tone.ts
- lib/knowns/types.ts
- lib/knowns/use-abortable.ts
- lib/knowns/utils.ts
- lib/knowns/icons/actor-icon.tsx
- lib/knowns/icons/model-icons.tsx
- lib/knowns/icons/tool-icons.tsx
- lib/knowns/icons/model-icons.data.ts
- lib/knowns/icons/tool-icons.data.ts
- lib/knowns/icons/LICENSES.md
- components/ui/knowns/spinner.tsx
- components/ui/knowns/button.tsx
- lib/knowns/motion.tsx
- lib/knowns/motion-utils.ts
- components/ui/knowns/segmented-control.tsx
- components/ui/knowns/blocks/site/open-in-ai.tsx
- components/ui/knowns/blocks/site/open-in-ai-utils.ts
and installs these npm packages: clsx@^2.1.1, tailwind-merge@^3.7.0, class-variance-authority@^0.7.1.
3. While it runs:
- It also adds a few @keyframes (all named kn-*) to the global CSS file (globals.css or the file components.json points at). Let it: they only add animations.
- If it asks to overwrite files under lib/knowns/: these are shared by every Knowns UI item. List them, say whether I changed them (check git), and ask me before you answer.
- If it asks to overwrite any other file, show me the diff and ask me.
4. Verify:
- Every file in the list above exists.
- The project type-checks (for example `npx tsc --noEmit`) and the dev build has no new errors.
5. Use it: follow the examples and props on https://ui.knowns.dev/docs/open-in-ai, and ask me if anything about my data is unclear.
If the Knowns UI MCP server is connected (https://ui.knowns.dev/docs/ai-and-mcp), use get_component({ name: "open-in-ai" }) or search_docs for details.
Finish with a short summary: the files you added or changed, the packages you installed, and anything I still need to do.The Claude and OpenAI marks come from the Knowns UI icon set and are trademarks of their owners, shown only to name the app a button opens. There is no Cursor mark in the set, so Cursor gets a plain pointer.
Props
- promptrequired
string- The prompt. Open in always sends this one.
- securePrompt
string- The same prompt with a key in it. Adds Safe / Include my key; only Copy uses it.
- secret
string- The key inside securePrompt, masked to its last 4 characters in the preview.
- providers
OpenInProvider[]- Default
Claude, ChatGPT, Cursor - Each { id, label, href(text), home, icon }. openInPresets() returns the built-in ones; [] hides Open in.
- foldLines
number- Default
6 - Lines shown before Show all.
- maxUrl
number- Default
6000 - Longest link handed out. Longer: Open in copies, then opens the app's new chat.
- onCopy
(which: "safe" | "secret") => void- After a copy. Show a toast here.
- onOpen
(id, how: "link" | "copy") => void- After an Open in press, and whether it went as a link or copy-then-open.
- label
string- Default
"Prompt" - The accessible name of the preview.
- copy
{ safe?, secret?, safeNote?, secretNote?, copy?, copied?, openIn?, footer? }- Your words.
- copyButtonProps
Record<`data-${string}`, string>- data-* attributes on the Copy prompt button, such as an analytics hook.
- className
string- Classes for the outer column.
| Prop | Type | Default | Description |
|---|---|---|---|
| promptrequired | string | required | The prompt. Open in always sends this one. |
| securePrompt | string | - | The same prompt with a key in it. Adds Safe / Include my key; only Copy uses it. |
| secret | string | - | The key inside securePrompt, masked to its last 4 characters in the preview. |
| providers | OpenInProvider[] | Claude, ChatGPT, Cursor | Each { id, label, href(text), home, icon }. openInPresets() returns the built-in ones; [] hides Open in. |
| foldLines | number | 6 | Lines shown before Show all. |
| maxUrl | number | 6000 | Longest link handed out. Longer: Open in copies, then opens the app's new chat. |
| onCopy | (which: "safe" | "secret") => void | - | After a copy. Show a toast here. |
| onOpen | (id, how: "link" | "copy") => void | - | After an Open in press, and whether it went as a link or copy-then-open. |
| label | string | "Prompt" | The accessible name of the preview. |
| copy | { safe?, secret?, safeNote?, secretNote?, copy?, copied?, openIn?, footer? } | - | Your words. |
| copyButtonProps | Record<`data-${string}`, string> | - | data-* attributes on the Copy prompt button, such as an analytics hook. |
| className | string | - | Classes for the outer column. |
What it handles
- 01Shows the first six lines of the prompt with the rest folded behind Show all, so a long prompt never takes half the screen.
- 02Copy prompt confirms in place for a moment and tells your app through onCopy, where you can show a toast.
- 03Open in starts a new chat in Claude, ChatGPT or Cursor with the prompt filled in. Pass your own providers, or none.
- 04With securePrompt it offers Safe or Include my key. Copy uses the choice; the Open in links always carry the safe prompt, because a link ends up in history and on the chat app's servers.
- 05Masks the secret in the preview down to its last four characters, so a screen share never shows the key.
- 06A prompt too long for a link (over 6,000 characters) is copied first, then the app opens on a new chat, with a note to paste.
States
- First render
- Nothing moves: the prompt shows folded
- none
- Show all
- The rest of the prompt unfolds and the chevron turns
- 200ms, ease out
- Copy prompt
- The label changes to Copied with a check, then back after 1.5s
- 120ms, ease out
- Include my key
- The thumb slides, the note turns amber and the preview frame gets an amber ring
- 120ms, ease in-out
- Reduced motion
- The fold and the label change at once
- 0ms
| State | What moves | Timing |
|---|---|---|
| First render | Nothing moves: the prompt shows folded | none |
| Show all | The rest of the prompt unfolds and the chevron turns | 200ms, ease out |
| Copy prompt | The label changes to Copied with a check, then back after 1.5s | 120ms, ease out |
| Include my key | The thumb slides, the note turns amber and the preview frame gets an amber ring | 120ms, ease in-out |
| Reduced motion | The fold and the label change at once | 0ms |
Works with
When to use
When to use
- Handing a setup or install prompt to someone's coding agent, with Copy and a one-click new chat.
- Turning a docs page or a support answer into a prompt the reader can run, with the key kept out of links.
When not to use
- Code someone pastes by hand: use Code Block.
- Saved prompts with blanks to fill in: use Prompt Templates.
- Writing a message to send: use Chat Composer.
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 Open in AI to my app and wire it to my own data.
- I need handing a setup or install prompt to someone's coding agent, with Copy and a one-click new chat. Set that up with the Knowns UI Open in AI.
- Which Open in AI props do I need for a minimal setup? Show me a short example.
With the server connected, your assistant calls get_component({ name: "open-in-ai" }) and search_docs({ query: "open in ai" }).