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.
SyncedLine is the simpler sibling of KaraokeLine. It holds a complete line of text with a start and end timestamp, but contains no syllable breakdown and therefore no character-level animation. It is the natural choice when only LRC-style timing data is available, when syllable data has not yet been generated, or as a lightweight rendering path for languages where syllable-level karaoke is not meaningful. KaraokeLyricsView handles SyncedLine entries transparently — no extra configuration is required.
When to Use SyncedLine
SyncedLine is the right data type whenever you have line-level timing but not word- or syllable-level timing. Common scenarios include:
- LRC files — the standard
.lrcformat marks timestamps at the start of each line, not per word. - Lyrics without word-level data — streaming services often provide line-synced metadata only.
- Fallback rendering — if syllable-level timing is unavailable for a language or track, you can populate the lyrics list with
SyncedLineobjects and the view will degrade gracefully. - Background vocals or ad-lib text — short annotations that do not warrant full karaoke treatment.
How It Renders
KaraokeLyricsView inspects each item in SyncedLyrics.lines at render time. When it encounters a SyncedLine, it routes it to SyncedLineText instead of KaraokeLineText. No configuration switch is needed — the routing is based on the runtime type of the line object.
SyncedLineText renders through the standard Compose Text composable rather than a custom Canvas, which means it benefits from normal text layout features (line wrapping, accessibility, copy/paste) without any custom drawing overhead.
The full SyncedLineText signature is:
| Parameter | Description |
|---|---|
line | The SyncedLine data containing content, optional translation, start, and end |
isLineRtl | Whether the text should be end-aligned and right-to-left |
textStyle | The TextStyle to apply to the line text (inherited from normalLineTextStyle) |
textColor | The base text color (inherited from KaraokeLyricsView.textColor) |
showTranslation | Whether to render line.translation below the main text |
RTL Detection
SyncedLineText relies on an externally computed isLineRtl flag — the caller (always KaraokeLyricsView) detects RTL by calling isRtl() on line.content. The isRtl() extension function checks whether any character in the string is an Arabic code point:
isLineRtl is true, SyncedLineText switches to Alignment.End for the column and TextAlign.End for the text:
CompositionLocalProvider for LocalLayoutDirection.
The current RTL detection only checks for Arabic characters. If you need RTL support for other scripts (Hebrew, Thaana, etc.), you can extend
isRtl() in your own utilities and pre-compute the isLineRtl flag before passing lines into the view. The SyncedLineText signature accepts the flag directly.Mixing Karaoke and Synced Lines
ASyncedLyrics object’s lines list is typed as List<ISyncedLine>, which is the common interface implemented by both KaraokeLine and SyncedLine. This means a single lyrics object can contain a mix of both types:
KaraokeLyricsView processes both types in the same LazyColumn and applies focus highlighting, blur, and auto-scroll identically to both — the only difference is which render path each line uses internally.