PlaceholderMarquee

PlaceholderMarquee

HkPlaceholderMarquee is the overflow strategy for a placeholder that does not fit its input. In marquee mode the overlay stays in the DOM as an invisible measuring probe while the text fits, and the host input shows its native placeholder; once the text overflows, the overlay becomes visible, renders the text three times side by side inside a clipping window and translates the strip in a loop. truncate mode hard-cuts the text at the container edge instead.

There is no Rust mirror of this component; it is Vue-only.

Import

tsx
1
import { HkPlaceholderMarquee, type PlaceholderVariant } from "@celestia-island/hikari";

The component renders the overlay only; the host owns the input, listens for overflowChange, and swaps its native placeholder for this overlay at that edge.

Marquee and truncate

variant="marquee" (the default) scrolls the overflow; variant="truncate" ellipsises it. text is the placeholder string, and an empty text renders nothing at all.

TSX
Search across every indexed document

Speed and direction

speed is the strip's travel in pixels per second and defaults to 24. A negative speed scrolls rightward (the loop plays in reverse), and a zero speed parks the strip as static text — as does a non-finite speed, which falls back to the default rate. The motion is pure CSS: one registered infinite keyframes animation whose loop distance and duration live on inline custom properties, measured once per geometry change rather than per frame.

TSX

Hosting it in an input

The overlay reacts to geometry, not to typing: a ResizeObserver on the host element re-measures on every size change, and text changes re-measure after the next paint. The overlay's own edge sits half a pixel past the host — the epsilon keeps an exact fit static — and it exposes setActive(active) so the host parks the strip while its input is focused, and measure() to force a pass. The overlay is aria-hidden, so it never competes with the input's own accessible name.

API

Vue

Props

NameTypeDefaultRequired
textString""—
variantString as PropType<PlaceholderVariant>"marquee"—
speedNumber24—

Emits

EventPayload
overflowChangeboolean

Accessibility

  • The overlay is aria-hidden="true": the placeholder overlays text, it never becomes the field's name or description.
  • The scrolling strip is a visual affordance only; a pointer or keyboard user reads the field's placeholder / aria-label exactly as before.
  • The animation lives on the compositor and the component parks it while the host input is focused, so it does not run under an active caret; the animation-context switch (html[data-css-animations="0"] and reduced motion) parks it as well.

Related components