Skip to content
ProLifetime access for $199, paid once, every future release included
Truffle UI

Selection Actions

ProNew

Highlight any passage to summon a floating AI rewrite toolbar with inline diff preview and one-click replacement.

Installation

pnpm dlx shadcn@latest add @viewport/selection-actions

First time? Add the @viewport registry to components.json. Setup takes one minute.

Usage

The code behind the preview above comes with Truffle Pro.

Props

PropTypeDefault
initialText*string

Editable passage shown inside the document surface.

—
defaultHighlightstring

Highlighted span inside `initialText` to pre-select on mount (or let the user select any text).

—
actions*RewriteAction[]

Rewrite actions shown in the floating toolbar.

—
onApply(nextText: string) => void

Called whenever a rewrite is accepted.

—
classNamestring—

Accessibility

  • Rewrite controls are grouped in a labelled toolbar with aria-pressed states.
  • Proposed changes use semantic del and ins elements.
  • Toolbar entrance and diff panel respect prefers-reduced-motion.