Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.velt.dev/llms.txt

Use this file to discover all available pages before exploring further.

New to wireframes? Start with UI Customization Concepts and the Template Variables overview.

Overview

The AI Rewriter feature places text-rewriting suggestions on a target text range with AI-generated rewrite options the user can pick from. Variables below are available inside any <velt-rewriter-...-wireframe> tag via three forms:
You want to…UseExample
Display a value as text<velt-data field="var" /><velt-data field="componentConfig.options.length" />
Hide / show conditionallyvelt-if="{var}"velt-if="{componentConfig.loading}"
Toggle a CSS classvelt-class="'cls': {var}"velt-class="'is-loading': {componentConfig.loading}"
This feature uses the flat-config access pattern — variables are referenced via the explicit componentConfig.<path> form. Each primitive carries its own componentConfigSignal — the text portal, the dialog, and the bottom-sheet expose different variable sets (documented separately below).

Component Config — Rewriter Text Portal

State on the <velt-rewriter-text-portal> inline highlight that sits over the rewriter’s target text.
VariableTypeDescriptionExample
componentConfig.rewriterPinAnnotationRewriterAnnotationThe annotation this portal represents.<velt-data field="componentConfig.rewriterPinAnnotation.from.name" />
componentConfig.firstbooleanAnnotation is the first in a stack.velt-class="'is-first': {componentConfig.first}"
componentConfig.lastbooleanAnnotation is the last in a stack.velt-class="'is-last': {componentConfig.last}"
componentConfig.isPhonebooleanMobile layout flag.velt-class="'is-phone': {componentConfig.isPhone}"

Component Config — Rewriter Dialog / Bottom Sheet

State shared between <velt-rewriter-dialog> and <velt-rewriter-bottom-sheet> (same data, different presentation).
VariableTypeDescriptionExample
componentConfig.searchCountnumberNumber of generation requests submitted so far.<velt-data field="componentConfig.searchCount" />
componentConfig.loadingbooleanGenerating new options.velt-class="'is-loading': {componentConfig.loading}"
componentConfig.bottomSheetModebooleanRenders as a bottom sheet (mobile).velt-class="'bottom-sheet': {componentConfig.bottomSheetMode}"
componentConfig.apiCalledbooleanAn AI generation call has been made.velt-if="{componentConfig.apiCalled}"
componentConfig.optionsstring[]AI-generated rewrite options.<velt-data field="componentConfig.options.length" />
componentConfig.selectedOptionIndexnumberCurrently-selected option (-1 when none).velt-class="'option-{componentConfig.selectedOptionIndex}-selected': true"

Type Reference

Types referenced by the variables above:
TypeDescription
RewriterAnnotationThe rewriter annotation — from, targetText, options, etc.

Subcomponents

Each subcomponent below has its own wireframe tag.

rewriters-container

The per-document orchestrator. Renders one rewriter portal per active rewriter annotation.
  • Public element: <velt-rewriters-container>
  • Wireframe tag: <velt-rewriters-container-wireframe>
PropertyValue
Extra variablesNone at the container level.

rewriter-text-portal

The inline highlight that sits over the rewriter’s target text.
  • Public element: <velt-rewriter-text-portal>
  • Wireframe tag: <velt-rewriter-text-portal-wireframe>
PropertyValue
Extra variablesSee Component Config — Rewriter Text Portal.
<VeltRewriterTextPortalWireframe
  velt-class="'is-first': {componentConfig.first}, 'is-last': {componentConfig.last}">
  <span className="my-rewriter-highlight">
    <velt-data field="componentConfig.rewriterPinAnnotation.from.name" />
  </span>
</VeltRewriterTextPortalWireframe>

rewriter-dialog

The desktop popover with rewrite options.
  • Public element: <velt-rewriter-dialog>
  • Wireframe tag: <velt-rewriter-dialog-wireframe>

rewriter-bottom-sheet

The mobile bottom-sheet variant — same data as rewriter-dialog, mobile UX.
  • Public element: <velt-rewriter-bottom-sheet>
  • Wireframe tag: <velt-rewriter-bottom-sheet-wireframe>
PropertyValue
Extra variablesSame as rewriter-dialog.
shouldShowRenders when componentConfig.bottomSheetMode === true.

Putting it together

A typical Rewriter dialog that swaps between a loading state, an empty (pre-call) state, and the rewrite-options list:
<VeltRewriterDialogWireframe
  velt-class="'is-loading': {componentConfig.loading}">
  <header className="my-rewriter__header">
    <span velt-if="{componentConfig.apiCalled}">
      <velt-data field="componentConfig.options.length" /> options
    </span>
    <span velt-if="!{componentConfig.apiCalled}">
      Pick a rewrite to start
    </span>
  </header>
  <div className="my-rewriter__loader" velt-if="{componentConfig.loading}">
    Generating…
  </div>
  <ul className="my-rewriter__options" velt-if="!{componentConfig.loading}">
    <li>
      <velt-data field="componentConfig.options.0" />
    </li>
  </ul>
</VeltRewriterDialogWireframe>