{"name":"captions","entry":"component","title":"Captions","description":"Kinetic subtitle pill that groups aligned words into phrases and lights each word as it is spoken.","category":"Motion","capabilities":["replay","player"],"needsRemotion":true,"registryDependencies":["@jbm/tokens","@jbm/motion-hooks"],"install":"npx shadcn@latest add @jbm/captions","installName":"captions","page":"https://jbm-ui.bns.studio/c/captions","registryItem":"https://jbm-ui.bns.studio/r/captions.json","sourcePath":"registry/jbm/motion/captions.tsx","files":[{"source":"registry/jbm/motion/captions.tsx","target":"src/jbm/motion/captions.tsx","import":"@/jbm/motion/captions","type":"registry:component"}],"endpoints":{"markdown":"https://jbm-ui.bns.studio/catalog/captions.md","json":"https://jbm-ui.bns.studio/catalog/captions.json"},"snippet":"import { Captions } from \"@/jbm/motion/captions\"\n\n<Captions words={[\n  { w: \"Una\", s: 0, e: 0.7 },\n  { w: \"idea.\", s: 0.7, e: 1.5, emph: true },\n]} />","api":[{"export":"Captions","kind":"component","summary":"Absolutely positioned ink pill near the bottom of the stage. Words group into phrases that break after punctuation, at pauses over 0.55 s, or at 9 words (landscape) / 6 words (vertical). A phrase fades in and out over up to 0.12 s; unspoken words sit at 0.28 opacity, and emphasized words turn the soft accent color with a small bounce. Renders nothing between phrases.","props":[{"name":"words","type":"Word[]","required":true,"default":null,"description":"Aligned words in order: `w` is the word (trailing punctuation ends a phrase), `s` and `e` are start and end times in seconds, and `emph` marks an emphasized word."},{"name":"orientation","type":"Orientation","required":false,"default":"\"landscape\"","description":"Stage orientation: `vertical` uses a larger 54px font, 6-word phrases, a 940px max width, and sits 270px from the bottom; `landscape` uses 44px, 9 words, 1500px, and 84px."},{"name":"offset","type":"number","required":false,"default":"0","description":"Seconds subtracted from the Sequence time before matching words, for word timings measured from a different origin."}],"passthrough":[]}],"stage":{"mode":"declared","landscape":{"width":"fill","height":83},"vertical":{"width":"fill","height":104},"basis":"Absolutely positioned from left 0 to right 0 of the positioned parent (the stage), bottom 84 in landscape and 270 in vertical. One line of text: 44px × 1.25 line-height + 2 × 14px padding = 83 in landscape; 54px × 1.25 + 2 × 18px = about 104 in vertical. Each wrapped line (past the 1500 / 940px max width) adds 55 / 68px."},"examples":[{"title":"Subtitles from aligned words","code":"import { Captions } from \"@/jbm/motion/captions\"\n\n<Captions words={[\n  { w: \"Una\", s: 0, e: 0.7 },\n  { w: \"idea.\", s: 0.7, e: 1.5, emph: true },\n]} />"},{"title":"Vertical video with a timing offset","code":"import { Captions } from \"@/jbm/motion/captions\"\n\n<Captions words={alignedWords} orientation=\"vertical\" offset={12.4} />\n// Place inside a positioned stage (e.g. Scene) in a Remotion composition."}],"qa":["Step through the first frame of a phrase (fading in), mid-phrase (spoken words bright, upcoming words dim, emphasis in the soft color), and the phrase end (fading out, then nothing between phrases).","Check grouping: a comma or period ends a phrase, a pause over 0.55 s starts a new one, and long runs split at 9 (landscape) or 6 (vertical) words.","Render in vertical: the pill sits above the lower safe area and long phrases wrap inside 940px without covering the subject.","The last phrase stays up to one second after its final word; confirm the composition is long enough to show its fade-out."],"related":[{"name":"tokens","relation":"installs"},{"name":"motion-hooks","relation":"installs"}],"galleryPreview":{"about":"Cue times are seconds on the gallery preview's timeline, which renders the demo below; the Usage examples may use other timings. Map a cue to your own props by its place in the demo.","fps":30,"durationInFrames":136,"lastFrame":135,"strip":"https://jbm-ui.bns.studio/c/captions?view=strip","frames":[{"label":"Empty stage","frame":0,"at":0},{"label":"Emphasis word","frame":33,"at":1.1,"note":"“idea” is spoken in the soft colour after its pop; later words wait at low opacity."},{"label":"Every word spoken","frame":75,"at":2.5,"note":"All words are at full opacity while the pill holds before fading out."},{"label":"End","frame":135,"at":4.5}],"demo":[{"component":"Pop","props":{"at":0},"children":[{"component":"Big","props":{"size":52},"children":"Cada palabra cuenta."}]},{"component":"Captions","props":{"words":[{"w":"Una","s":0,"e":0.7},{"w":"idea","s":0.7,"e":1.4,"emph":true},{"w":"a","s":1.4,"e":1.8},{"w":"la","s":1.8,"e":2.2},{"w":"vez.","s":2.2,"e":3.5}]}}],"code":"<Pop at={0}>\n  <Big size={52}>Cada palabra cuenta.</Big>\n</Pop>\n<Captions words={[{ w: \"Una\", s: 0, e: 0.7 }, { w: \"idea\", s: 0.7, e: 1.4, emph: true }, { w: \"a\", s: 1.4, e: 1.8 }, { w: \"la\", s: 1.8, e: 2.2 }, { w: \"vez.\", s: 2.2, e: 3.5 }]} />"},"setup":{"namespace":"@jbm","componentsJson":{"registries":{"@jbm":"https://jbm-ui.bns.studio/r/{name}.json"}},"command":"npx shadcn@latest add @jbm/<name>","target":"src/jbm/","importAlias":"@/jbm/…","tsconfigPaths":{"@/*":["./src/*"]}},"rules":["Install through the @jbm namespace: each registry item JSON (/r/<name>.json) carries its files' contents and each guide is served at /docs/<slug>.md, so agents never need the source repository (it is public on GitHub for people browsing the code).","Files install to src/jbm/ and import as @/jbm/…, which needs the @/* → ./src/* path alias in tsconfig.json.","Items marked needsRemotion require the remotion package and must render inside a Remotion composition or Player; every other item works in any React page.","Use one vermilion accent per composition; accent2 is for annotations only and soft is for dark surfaces only.","Stages are 1920×1080 landscape and 1080×1920 vertical with declared safe areas; each item's stage field declares its size in stage pixels, and scenes compose from YAML-shaped specs with @jbm/scene-spec."],"links":{"catalog":"https://jbm-ui.bns.studio/catalog.json","llms":"https://jbm-ui.bns.studio/llms.txt"}}