Skip to content
Back

Ghost textPro

Inline AI autocomplete: muted ghost text continues your sentence at the caret, Tab turns it solid in place, ⌘→ takes a word, Esc fades it away, and a chip names the model.

oxyn add ghost-text
Suggestions appear after a pause. Tab accepts, Command or Alt with Right Arrow accepts a word, Escape dismisses.
Tab to acceptTab accept · ⌘→ word · Esc dismiss
The code is part of Oxyn Pro

The preview stays free for everyone. Pro opens the code of every Pro component, screen, agent-app template, block and kit, plus the Pro CLI.

Get Pro

Rendered from Rust at build time · goes live when visible

When to use

  • Inline AI autocomplete.
  • After delay_ms (450) of pause and at least min_len (3) trimmed characters, the model is asked for a continuation of the text; it shows muted right after the text, fading in (140 ms).
  • Typing that matches the ghost consumes it in place; any other edit clears it and a new ask follows the next pause.
  • Tab accepts all of it, ⌘/Ctrl/Alt+→ accepts one word (the rest stays), Escape dismisses it (with nothing showing Escape is left to the page); moving the caret away (←, ↑, Home, a click) or leaving the field clears it.

When not to use

  • On or off for things that apply right away: use Switch instead.
  • A real checkbox with a label and second line, an indeterminate state for Select all, an error, a card row and a check that draws itself: use Checkbox instead.
  • Pick one: use Radio group instead.

Installation

Ghost text is part of Oxyn Pro; the preview is free. Pro items install with the oxyn CLI once your licence is signed in; until then Pro members copy the code from this page.

Terminal
oxyn add ghost-text

Usage

Dioxus · rust
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Examples

Field

A suggestion waits after the text: Tab takes it.

Suggestions appear after a pause. Tab accepts, Command or Alt with Right Arrow accepts a word, Escape dismisses.
Tab to acceptTab accept · ⌘→ word · Esc dismiss
Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Single

Single line with the chip inline at its end.

Tab to accept
Suggestions appear after a pause. Tab accepts, Command or Alt with Right Arrow accepts a word, Escape dismisses.
Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Plain

Plain: flush inside a card of your own.

Suggestions appear after a pause. Tab accepts, Command or Alt with Right Arrow accepts a word, Escape dismisses.
Tab to acceptTab accept · ⌘→ word · Esc dismiss
Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Offline

The chip says No suggestion.

Suggestions appear after a pause. Tab accepts, Command or Alt with Right Arrow accepts a word, Escape dismisses.
No suggestion
Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

API reference

GhostText

PropTypeDefaultDescription
valueStringDefault::default()Starting text.
placeholderOption<String>Default::default()Placeholder.
labelOption<String>Default::default()Quiet label row above the text (multi-line only).
modelString"Autocomplete"Model named in the chip.
multilinebooltrueGrowing textarea with a footer row, or a single line with the chip at its end.
variantString"field"`field` (own border and ring) · `plain` (sits flush in a card).
rowsusize3Minimum lines.
hintbooltrueShow the chip and key hints.
offlineboolDefault::default()The model fails every ask (demos the error chip).
delay_msu64450Pause before asking, ms.
latency_msu64380Simulated model latency, ms.
disabledboolDefault::default()Disabled.
nowrequiredClockMs—Shared clock.
on_acceptEventHandler<(String, &'static str)>—Accepted text, with "all" or "word".
on_inputEventHandler<String>—Every edit.

Read from the Rust signature and doc comments.

Keyboard interactions

KeyAction
TabAccepts the whole suggestion (moves focus when none shows)
⌘/Ctrl/Alt→Accepts the next word
EscDismisses the suggestion (left to the page when none shows)
TypingMatching characters consume the ghost; others clear it
← ↑ HomeorclickMoving the caret away clears it

Accessibility

  • The ghost is drawn in an aria-hidden mirror; the field keeps its own text.
  • aria-describedby explains the keys; the chip is a polite live region.
  • Reduced motion drops the fade and the accept ease.
From the spec
  • The ghost is drawn in an aria-hidden mirror under a transparent-text field, so the field's own value is what assistive tech reads.
  • aria-describedby explains the keys; the chip is a polite live region.

Motion & interaction

Timing
  • Reduced motion: rows open at full height, words and digits swap without rise or roll, the ghost appears and turns solid without fading, the height tween is off.

Responsive behaviour

  • Key hints hide on narrow fields; the chip stays.
Edge cases (spec)
  • Key hints hide below 420 px of container width; the chip stays.

Notes for AI

  • Import GhostText from oxyn_dioxus and include STATUS_INDICATOR_CSS plus the token stylesheet once.
  • There is no GPUI version yet; use the Dioxus component.
  • Props to set first: now.
  • It reads a clock (now) for live timers; pass one clock for the whole page rather than one per component.
  • Keep its states and timings as they ship; restyle it through the CSS variables rather than by hand.

Guides

Oxyn · 74 free components · 264 Pro components · 96 screens · 20 blocks · Dioxus and GPUI