Suggestion Banner

One AI suggestion in place: apply, dismiss, other options, and undo.

PROGet Suggestion Banner and 168 other Pro components with pro lifetime — Get Pro

Category
AI Chat
Access
Pro
Source
334 lines · one file
States
5 drawn

The decision inside it

Confidence is a word, not a percentage

0.73 means nothing to a reader; "Fairly sure" tells them whether to look twice. A number you pass is bucketed into Likely, Fairly sure or Not sure, with the exact figure kept in the tooltip.

When to use it

Use Suggestion Banner when an agent proposes one change the person can take or leave: a rewrite, a tag, a fix. Say how sure it is with confidence, offer other options with alternatives, and let them undo. For a set of file edits to review, use Code Diff View instead.

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 Suggestion Banner for this.
Install it: npx shadcn@latest add @liro/suggestion-banner
(the @liro registry is set up in components.json, with LIRO_KEY in .env.local)
Import it from @/components/ui/suggestion-banner.
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/clause-suggestion.tsx
import { SuggestionBanner } from "@/components/ui/suggestion-banner";

export function ClauseSuggestion({ apply, dismiss, revert }: { apply: (option?: string) => void; dismiss: () => void; revert: () => void }) {
  return (
    <SuggestionBanner
      title="Shorten the payment terms to 14 days"
      description="Your last six contracts with Vertically used 14 days."
      confidence="high"
      alternatives={[{ id: "30", label: "Keep 30 days, add a late fee" }]}
      onApply={(id) => apply(id)}
      onDismiss={dismiss}
      undoable
      onUndo={revert}
    />
  );
}

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
titlestring YesWhat applying would do, as an action ("Send the renewal to Olivia").
descriptionstring NoWhy the model suggests it, in a sentence.
confidence"low" | "medium" | "high" | number NoHow sure the model is: a word, or 0–1.
alternativesSuggestionAlternative[] NoOther ways to do it, behind the arrow on Apply.
variant"inline" | "floating" No"inline" in the flow of the page, "floating" as a lifted card. Default inline.
onApply(altId?: string) => void NoCalled with no id for the main suggestion, or an alternative's id.
onDismiss() => void NoCalled when dismissed. The banner hides itself either way.
undoableboolean NoAfter Apply, show "Applied · Undo" for a few seconds.
onUndo() => void NoCalled when Undo is pressed.
onSettled() => void NoCalled when the Undo window closes and the change stands (or right after Apply without `undoable`).
applyLabelstring NoThe Apply button's words. Default "Apply".
undoSecondsnumber NoSeconds the Undo stays. Default 6.

Dependencies

npm packages

clsxframer-motionlucide-reacttailwind-merge

Liro foundations, installed alongside it

liro-theme

States

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

  • Suggested
  • Alternatives open
  • Applied with Undo
  • Not sure
  • Dismissed

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