jbmui

Burbuja

  • UI
  • adjustable

Chat bubble whose selected words sweep to vermilion with a controlled 0–1 highlight.

Tú
Podemos reutilizar estos componentes.

Install

npx shadcn@latest add @jbm/burbuja

Needs the @jbm entry in components.json; see Install once.

Also installs @jbm/tokens, @jbm/chat-bubble, @jbm/text-fill.

Docs

Usage

Highlight one word
import { Burbuja } from "@/jbm/motion/burbuja"<Burbuja words={["Podemos", "reutilizar", "componentes."]}  highlight={[1]} progress={1} speaker="Tú" />
Drive the highlight from a Remotion timeline
import { Burbuja } from "@/jbm/motion/burbuja"import { useProgress } from "@/jbm/motion/hooks" // install @jbm/motion-hooks separately// Render inside a Remotion <Composition> or <Player>: hooks run in the component body.export function SpeakingBubble() {  const progress = useProgress(0.5, 1, 0.8)  return <Burbuja side="end" words={["Una", "pieza", "a", "la", "vez."]} highlight={[1, 4]} progress={progress} />}

Props

Stage
fluid

ChatBubble is fit-content up to 100% of its container, so width follows the words and height follows wrapping. At 18px type with line-height 1.5 it adds 16px/20px of padding and edge, an optional ~20px speaker line, and 13px for the tail.

Composes ChatBubble and TextFill: the message is a list of words joined by single spaces, and the words at the highlight indices sweep from the surrounding text color to the vermilion accent as progress goes from 0 to 1. Pure React with no timer; ordinary HTML handles wrapping.

PropTypeDefaultDescription
side"start" | "end"noneWhich side the bubble aligns to and where its tail sits: start or end.
tone"paper" | "ink" | "accent"noneBubble fill: paper (card with ink text and ChatBubble's ink outline), ink, or accent (both with cream text). Highlighted words always end in the vermilion accent, so avoid accent tone when they must stand out.
tailbooleannoneShows ChatBubble's tail under the bubble, outlined with the body as one line on paper, and reserves 13px of bottom margin for it.
speakerReact.ReactNodenoneOptional mono label above the message, e.g. the speaker's name.
wordsreadonly string[]requiredMessage words in order; rendered joined by single spaces.
highlightreadonly number[]requiredZero-based indices into words that receive the TextFill sweep. Out-of-range indices are ignored.
progressnumber1Highlight progress from 0 (highlighted words in the bubble's text color) to 1 (fully vermilion). Clamped by TextFill; non-finite values render as 0.

Also accepts Omit<ChatBubbleProps, "children">.

QA checks

  • Drag Highlight through 0, 0.5, and 1: only the selected words change color, the sweep runs left to right, and at 1 they rest in vermilion.
  • Check spacing and wrapping are unchanged by the highlight: highlighted words keep the bubble's font size, weight, and line height.
  • Compare paper, ink, and accent tones and both sides; note that the accent tone hides an accent highlight.
  • Verify at a narrow width that long words wrap inside the bubble and the tail stays attached.