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.
KaraokeLyricsView is the top-level composable for the Accompanist Lyrics UI library. It renders a scrollable, animated lyrics view that supports both syllable-timed karaoke lines and simpler line-synced lyrics. The component automatically scrolls to the currently active line, applies blur and scale effects to inactive lines, shows breathing-dot animations during instrumental interludes and intros, and handles both LTR and RTL text direction. Pass a LazyListState created with rememberLazyListState() so you can observe or programmatically control the scroll position from outside the composable.
Function Signature
Parameters
The scroll state for the internal
LazyColumn. Create with rememberLazyListState() in the calling composable and hoist it if you need to observe or control the scroll position externally. KaraokeLyricsView uses this state to auto-scroll to the active line as playback progresses.The lyrics data to display. A
SyncedLyrics object contains a list of ISyncedLine items — each of which is either a KaraokeLine (syllable-timed) or a SyncedLine (line-timed). The composable re-measures all karaoke layout caches when this value changes.A lambda that returns the current playback position in milliseconds. The composable reads this value on every frame to determine which line is active, which interlude should show breathing dots, and how far to auto-scroll. Wrap your player’s position in
rememberUpdatedState or pass it directly as a lambda to avoid unnecessary recompositions.Callback invoked when the user taps a lyric line. The tapped
ISyncedLine is passed as the argument. Typically used to seek playback to the line’s start time (line.start).Callback invoked when the user long-presses a lyric line. The pressed
ISyncedLine is passed as the argument. Typically used to present a share sheet or context menu.Modifier applied to the outermost
Box container. Use this to set size, padding, background, or any other standard Compose layout modifier.Text style applied to main vocal lyric lines. The default uses 34 sp bold text with
TextMotion.Animated to enable smooth glyph-level animations. This style is also used as the base from which phoneticTextStyle is derived.Text style applied to accompaniment / background-vocal lines (
KaraokeLine.AccompanimentKaraokeLine). Defaults to 20 sp bold with TextMotion.Animated — slightly smaller than the main vocal style to visually subordinate these lines.Primary text color used for all lyric lines, breathing dots, and translation text. The active (sung) portion of a karaoke line is drawn at full opacity, while inactive portions and translations are drawn at reduced alpha derived from this color.
Configuration object for the breathing-dot animation shown during instrumental intros (first line starts after 5 s) and interludes (gap between consecutive lines exceeds 5 s). See
KaraokeBreathingDotsDefaults for all configurable fields including dot count, size, margin, and animation durations.Text style for inline phonetic annotations rendered above individual syllables. Derived from
normalLineTextStyle by default; override to change font family, size, or weight independently of the main line style.Blend mode used when compositing lyric text onto the background.
BlendMode.Plus creates a luminous, glowing appearance well-suited to dark backgrounds. Set to BlendMode.SrcOver for standard non-additive rendering on lighter backgrounds.When
true, lines that are not currently active are blurred in proportion to their distance from the focused line (controlled by blurDelta). Set to false to disable all blur effects, for example on lower-end devices or when accessibility requirements demand it.Whether to render the translation string (if present on a line) beneath the main lyric text. Pass
false to hide translations globally.Whether to render phonetic annotations — both the inline per-syllable phonetics drawn on the canvas and the line-level phonetic string beneath the line. Pass
false to hide all phonetics globally.Vertical padding added at the very start and end of the lazy list via
contentPadding. This ensures the first and last lyric lines are not flush against the edges of the viewport.Extra vertical space (in addition to
offset) that is kept visible around the active line when auto-scrolling. A larger value keeps more context lines visible above the focused line. This value also expands the list’s measured height so that items near the scroll position are not clipped.The amount of blur (in pixels) applied per line of distance from the currently focused line when
useBlurEffect is true. For example, the line immediately before or after the active one receives 1 × blurDelta blur radius, two lines away receives 2 × blurDelta, and so on.When
true, draws colored bounding rectangles around each glyph and syllable on the lyrics canvas — green for simple syllables, red for character-animated glyphs. Intended for development and layout debugging only; keep this false in production builds.Usage Example
KaraokeLyricsView pre-calculates all syllable layout data on a background coroutine (Dispatchers.Default) whenever lyrics, normalLineTextStyle, accompanimentLineTextStyle, or phoneticTextStyle changes. This means the first frame after a lyrics change may render without pre-computed layouts; subsequent frames will use the cache automatically.