Documentation Index
Fetch the complete documentation index at: https://mintlify.com/6xingyv/accompanist-lyrics-ui/llms.txt
Use this file to discover all available pages before exploring further.
KaraokeLineText renders a single KaraokeLine with full syllable-level karaoke animation. As playback progresses, a horizontal fill gradient sweeps across the text, each character bounces and swells as it is sung, and phonetic annotations float above their syllables. The composable handles multi-row line wrapping, LTR/RTL detection, accompaniment sub-lines with enter/exit animations, and optional translation text. While it is used internally by KaraokeLyricsView, you can embed it standalone wherever you need to display a single animated karaoke line.
Function Signature
Parameters
The karaoke line data to render. This can be a
KaraokeLine.MainKaraokeLine (which may also carry a list of accompanimentLines) or a KaraokeLine.AccompanimentKaraokeLine. The composable reads the line’s syllables, alignment, translation, phonetic, start, and end fields to drive all animations and layout.A lambda returning the current playback position in milliseconds. The canvas redraws itself by reading this lambda on every frame; use a stable lambda reference (e.g. from
rememberUpdatedState) to avoid triggering unnecessary recompositions.Modifier applied to the outer
Column that wraps the canvas, translation text, and phonetic text. Use this to control width, padding, or alignment when embedding KaraokeLineText outside of KaraokeLyricsView.Text style used for main vocal lines (
KaraokeLine.MainKaraokeLine). This style drives text measurement and therefore directly affects the canvas size and glyph positions.Text style used for accompaniment / background-vocal lines (
KaraokeLine.AccompanimentKaraokeLine). Should generally be smaller than normalLineTextStyle to visually subordinate these lines.Text style for per-syllable phonetic annotations rendered above the main text on the canvas. Also used for the line-level
phonetic string displayed below the canvas when showPhonetic is true.The color of the text. The karaoke fill gradient transitions from a dimmed version of this color (alpha ≈ 0.2) to full
activeColor as each syllable is sung. Translation text is drawn at activeColor.copy(alpha = 0.4f) and the line-level phonetic at activeColor.copy(alpha = 0.6f).Blend mode applied via
graphicsLayer to the translation and phonetic Text composables, and passed through to the canvas drawing calls. Match this to the blendMode used by the parent LyricsLineItem for consistent compositing.When
true, draws colored bounding rectangles around each rendered glyph on the canvas — green for simple-animation syllables, red for character-bounce-animation syllables. Intended for development only; do not ship with this enabled.Whether to display the line’s
translation string (if non-null) below the canvas. The translation is rendered at activeColor.copy(alpha = 0.4f) and aligned to match the line’s detected text direction.Controls two things: inline per-syllable phonetics drawn on the canvas above each syllable, and the line-level
phonetic string rendered below the canvas. Set to false to suppress both.An optional pre-computed list of
SyllableLayout objects for the line’s syllables. When provided, the composable skips the text-measurement step on the composition thread, improving performance for long lyrics lists. KaraokeLyricsView pre-fills this from its background layout cache and passes it here automatically. When null, layouts are computed synchronously during composition.Reserved flag indicating whether this line is being rendered inside a duet/duo view layout. Currently accepted by the composable signature for future use; no visual difference is applied in the current implementation.
The
TextMeasurer used to measure syllable and phonetic glyphs. When using KaraokeLineText standalone, the default (rememberTextMeasurer()) is sufficient. When embedding multiple instances in a list, share a single measurer instance from the parent for better performance.Usage Example
Text measurement is performed synchronously by default whenever
precalculatedLayouts is null. In a long scrolling list this can cause jank on the first render of each item. Pass pre-computed SyllableLayout lists (as KaraokeLyricsView does internally) to avoid this.