Prodular UI

Inline assist

AIPro

The Cmd+K inline edit for text: select a passage, ask the AI how to change it, then review the proposed change as a diff and accept, reject or try again.

npx prodular-ui add inline-assist

Part of Prodular UI Pro. Preview and read the docs freely, install with a license. See pricing

In a document

Select a sentence. Ask AI to edit appears under it, Cmd+K opens the instruction. Try Make it shorter or Fix grammar on the second paragraph.

Q3 close memo

Select text, then press ⌘K
Close for Q3 is basically done. We're still waiting on 3 vendor credits from Halcyon Freight, which means accounts payable is a little higher than it should be. In order to finish on time we need the credits by Friday, otherwise we'll book an accrual and fix it in October. Revenue came in at $4.82M, up 12% on Q2. Most of the growth came from the Team plan, which grew faster then we expected after the price change in July. Churn stayed flat at 1.9%.

In a support reply

Select the whole reply and choose Make it warmer. Enter accepts, Escape rejects.

Reply to Lena Fischer, ticket #48213
Hi Lena, sorry about this. Looks like you got charged twice on October 14 because the card retry ran after the first payment already went through. I've refunded the second charge of $480.00, you should see it in 5 to 10 business days.

Anatomy

<InlineAssist  value={text}  onValueChange={setText}  onGenerate={async ({ instruction, selection, signal }) => {    const res = await fetch("/api/edit", { method: "POST", body: JSON.stringify({ instruction, selection }), signal })    return (await res.json()).text  }}/>

Guidance

Use it when

  • Use it where people write longer text and want to change part of it: memos, replies, descriptions, release notes.
  • Offer two to four quick instructions in suggestions that fit the surface, such as Make it warmer for support replies.
  • Let people try again with the same instruction before they reject.

Avoid

  • Replacing the text before the person accepts. The proposal is shown as a diff in place.
  • Using it for single line inputs. Use AiSuggestion or AiGhostInput there.
  • Hiding what will change. The diff shows removed text struck through and added text highlighted.

Rules for AI agents

Published in llms-full.txt, the registry and the MCP server, so coding agents follow them when they build with this component.

  • Control the text with value and onValueChange. onValueChange is called only when the person accepts a proposal.
  • Implement onGenerate to return only the replacement for the selection, not the whole document. Use before and after only as context.
  • Respect request.signal: abort the model call when it fires and reject the promise. Stop and Escape trigger it.
  • Reject the promise on failure. The component shows an error with Try again. Never resolve with an error message as text.
  • Do not add your own Cmd+K, Enter or Escape handlers around InlineAssist. It handles them while a selection or proposal is active.

API

InlineAssist

PropTypeDefaultDescription
value / onValueChangestring / (value: string) => voidPlain text. Paragraphs separated by blank lines.
onGenerate(request: { instruction, selection, before, after, signal }) => Promise<string>Returns the replacement for the selection.
suggestionsstring[]["Make it shorter", "Make it more formal", "Fix grammar"]Quick instructions under the prompt input.
contentClassNamestringClasses for the text surface, for example a smaller size.

Installation

The Prodular UI CLI adds the source to components/ui with everything it depends on. In a project that already uses shadcn/ui, the shadcn CLI installs it from the Prodular registry too. See Installation for the first setup.

npx prodular-ui add inline-assist# or, with the registry in components.jsonnpx shadcn@latest add @prodular/inline-assist