Skip to main content

UI Components

Audience: End users and non-technical stakeholders Last Updated: 2026-04-05 Version: 2.0.0


Overview

The UI Components system is the visual and interactive foundation of Llamafin. It provides a comprehensive suite of overlays (modals, alerts, toasts, popovers), player interfaces (full-screen player, visualizers, lyrics), interaction tools (selection, scroll optimisation, sleep timer), and device-aware features (haptics, keep-awake, theme adaptation).

The system is designed for performance, accessibility, and cross-platform consistency, automatically adapting to iOS, Android, Windows, macOS, and Linux environments.


Key Concepts

1. Overlay System

Llamafin uses several types of overlay components to communicate with users:

Overlay TypePurposeExamples
ModalsFull-screen or partial-screen dialogues that capture focusFull-screen player, download options, playlist creation, settings dialogues
AlertsSystem-level notifications requiring user attentionNetwork connectivity loss, destructive action confirmations
ToastsBrief, auto-dismissing messagesSuccess confirmations, error notifications, informational tips
Action SheetsBottom-sheet menus with contextual actionsDiagnostics export, text display lists
PopoversSmall anchored menusMulti-select options, export choices, language picker

2. Modal Stack System

Llamafin supports multiple simultaneous modals organised in a stack:

  • Open a modal: It appears on top of the stack
  • Close a modal: The topmost modal dismisses with a smooth animation
  • Replace a modal: The topmost modal swaps to a new one without closing the stack

This enables complex workflows like opening download options from within the full-screen player without losing context.

3. Global Toast System

All notifications across the app flow through a unified toast system:

  • Informational messages display for 5 seconds
  • Error/failure messages stay on screen until you dismiss them
  • Actionable toasts include a navigation arrow that takes you to the relevant page
  • No stacking: Only one toast displays at a time to prevent screen clutter

4. Confirmation System

Destructive or significant actions require explicit confirmation:

  • Delete server source
  • Remove downloaded item
  • Clear cache
  • Delete playlist
  • Trim history
  • Quit application

Each confirmation dialogue is translated into your preferred language and can include input fields for custom values (e.g., custom cache size).

5. Player Views

The full-screen player offers 5 distinct view modes:

ViewDescription
CoverStandard album artwork display
RecordVinyl record animation with spinning disc
LyricsSynchronised lyrics display
VisualiserReal-time audio Visualisation (Butterchurn/MilkDrop compatible)
TurntableTurntable animation view

Your preferred view and visualizer are saved automatically and restored across sessions.

6. Visualizer System

Llamafin includes a Butterchurn audio visualizer (compatible with Winamp's MilkDrop):

  • Real-time rendering synced to audio playback
  • Multiple presets with smooth transitions (1.2-second crossfade)
  • Quality settings adjustable based on device performance
  • WebGL support detection for hardware-accelerated rendering
  • Performance optimised: Runs outside the main UI thread to avoid frame drops

7. Theme System

Llamafin adapts to your visual preferences:

ThemeDescription
LightStandard light theme
DarkDark background with light text
BlackPure black background (AMOLED-friendly)
WhiteHigh-contrast white theme

System Theme Tracking: When enabled, Llamafin automatically follows your device's light/dark mode setting and updates in real-time when the system preference changes.

8. Multi-Select & Selection System

Llamafin supports batch operations through multi-select mode:

  • Per-context selection: Each list maintains its own independent selection state
  • Toggle mode: Enter/exit multi-select without affecting other lists
  • Visual feedback: Selected items are clearly highlighted
  • Batch actions: Delete, download, add to playlist, and more on multiple items simultaneously

9. Virtual Scrolling

For large libraries (thousands of songs/albums), Llamafin uses virtual scrolling:

  • Only visible items (plus a buffer) are rendered in the DOM
  • Scroll position is tracked to determine which items to render
  • Performance optimised: Prevents unnecessary re-renders with threshold-based updates
  • Context-aware: Each list maintains independent scroll state

10. Sleep Timer

The sleep timer automatically pauses playback after a specified duration:

  • Set a timer duration (e.g., 30 minutes, 1 hour)
  • A countdown runs in the background
  • When the timer expires, playback pauses and you receive a notification
  • Cancel at any time from the player

11. Keep-Awake System

When watching the full-screen player or visualizer, Llamafin can prevent your device from sleeping:

  • Automatically activates when full-screen player opens
  • Deactivates when you close the player
  • Respects your settings preference
  • Uses native platform APIs (iOS/Android) for reliable behaviour

12. Haptic Feedback

On supported mobile devices, Llamafin provides haptic feedback for interactions:

  • Selection start/changed/end: Subtle taps when interacting with lists
  • Impact feedback: Customizable intensity for specific actions
  • Toggle on/off: Controlled in Advanced Settings
  • Automatic detection: Only available on devices with haptic hardware

13. Device-Aware UI

Llamafin adapts to your device characteristics:

AdaptationDescription
Operating SystemUI patterns adjust for iOS, Android, Windows, macOS, or Linux
Window SizeResponsive layout adapts to window dimensions (desktop)
OrientationDetects portrait vs. landscape and adjusts layout
Custom ScrollbarsPlatform-specific scrollbar styling where needed
Text TruncationAdjustable text length limits based on screen size

Shared Reusable Components

Llamafin includes a library of 50+ reusable UI components used throughout the application:

Audio Item Renderers

  • Audio Item: Universal component for displaying songs, albums, artists in list, grid, or track modes. Handles download status, preview playback, multi-select, and background analysis indicators.
  • Audio Item Image: Displays album/artist artwork with automatic fallback to generated placeholders.
  • Mini Player: Persistent bottom player bar with playback controls, progress indicator, and tap-to-expand full-screen player.

Loading & Skeleton System

  • Loading Shell: App initialisation screen with progress indicator, tips carousel, error recovery options, and force-offline mode button.
  • Skeleton Loader: Placeholder animations while content loads.
  • Llam Spinner: Advanced animated spinner with 30+ animation styles including ring, bars, pulse, wave, particles, DNA, plasma, equalizer, radar, vortex, kaleidoscope, constellation, vinyl, oscilloscope, and more. Supports audio-reactive mode and respects device "reduced motion" accessibility settings.

Layout Components

  • Library Layout: Master layout supporting grid, list, and carousel display modes. Optimises visual effects (glass morphism, shadows) based on device hardware capabilities.
  • Library FAB: Floating action button for quick access to common library actions.
  • Page Header: Standardized page headers with consistent styling.

Marquee & Text Components

  • Fast Marquee: Smooth scrolling text for long titles that overflow available space.
  • Overflowing Text: Automatically switches between static text and marquee based on content length.
  • Sliding Text: Animated text sliding animation for dynamic displays.

Progress Indicators

  • Circle Progress: Circular progress indicator for downloads, caching, and other operations.
  • Metric Charts: Chart.js-based charts for device metrics, history, and analytics.

Debug Overlays (Development/Advanced Users)

  • Audio Debug: Audio engine status display
  • FPS Counter: Real-time frame rate monitoring
  • Performance Overlay: Performance metrics display
  • Memory Overlay: Memory usage monitoring

Configuration

Appearance Settings

SettingOptionsDescription
ThemeLight, Dark, Black, WhiteBase application theme
Track System ThemeOn, OffAutomatically follow device light/dark mode
Background ColoursMultiple presetsPlayer background colour palette
Font FamilySystem fonts, custom fontsTypography for text elements
Visualizer QualityLow, Medium, High, UltraRendering quality for audio visualizers
Active Visualizer20+ presetsChoose your preferred visualizer preset
Player ViewCover, Record, Lyrics, Visualizer, TurntableDefault full-screen player view
Keep Screen OnOn, OffPrevent device sleep during playback

Interaction Settings

SettingOptionsDescription
Haptics EnabledOn, OffEnable haptic feedback on supported devices
Sleep Timer DurationCustom durationDefault timer length

Accessibility

SettingDescription
Reduced MotionRespects device setting to minimise animations
Custom ScrollbarsPlatform-appropriate scrollbar styling
Text TruncationConfigurable text length limits

How It Works

1. User taps button to open modal

2. Modal is pushed onto the stack

3. Modal renders via global registry (centralized host)

4. CSS class applied for custom styling

5. User interacts with modal content

6. User dismisses modal (swipe, back button, or action)

7. Animation plays (two-stage dismissal for smooth transitions)

8. Modal removed from stack

9. Return data captured for calling feature (if applicable)

Benefits:

  • Consistent animation across all modals
  • No visual glitches from premature removal
  • Return data flows back to calling feature automatically
  • Keep-awake automatically managed for full-screen player

Toast Notification Flow

1. Any feature performs action (download, delete, play, etc.)

2. Feature dispatches action with message payload

3. Unified toast listener intercepts the action

4. Message text translated to user's language

5. Toast displayed with appropriate styling (error=red, success=green, etc.)

6. If actionable: navigation arrow button included

7. Auto-dismisses after 5 seconds (errors stay until dismissed)

Benefits:

  • No duplicate toast logic across features
  • Consistent messaging behaviour
  • Automatic i18n translation
  • Actionable toasts reduce navigation friction

Virtual Scrolling Process

1. User scrolls through a long list

2. Scroll position tracked (debounced to avoid excessive updates)

3. Render window calculated: visible items + buffer (10 before, 40 after)

4. Only items in render window are in the DOM

5. Threshold check: only update if change exceeds half the buffer

6. DOM updated with visible items

Benefits:

  • Smooth scrolling even with 10,000+ items
  • Minimal memory usage (only visible items rendered)
  • No layout jank from excessive re-renders

Theme Application

1. User selects theme (or system theme changes)

2. Theme action dispatched to store

3. Effect applies theme via data-theme attribute on document body

4. CSS custom properties update all component colours

5. Preference saved to storage for next session

System Theme Tracking:

  • Listens to prefers-colour-scheme media query changes
  • Responds to both dark and light system preference changes
  • Initial theme set based on system preference when tracking enabled

Visualizer Lifecycle

1. User switches to visualizer view

2. Canvas element provided to visualizer system

3. Butterchurn initialised with audio context and quality settings

4. Active preset loaded with smooth transition

5. When playback starts: AnalyserNode connected

6. Rendering loop runs outside Angular zone (performance optimised)

7. FPS throttled based on quality settings

8. On quality change: clean destroy → reinit cycle

9. On view change or component destroy: audio disconnected, resources freed

Benefits:

  • No memory leaks from orphaned audio connections
  • Smooth preset transitions (1.2-second crossfade)
  • Performance adapts to device capabilities
  • WebGL detected and used when available

Integration with Other Features

FeatureIntegration PointDescription
Network StatusNetwork AlertAutomatically shows alert when offline, hides when reconnected
DownloadsDownload Options ModalChunked download progress, quality selection, smart download configuration
Player & QueueFull-Screen PlayerPlayer UI state drives view switching, visualizer, theme colours, fullscreen mode
SettingsTheme, Appearance, InteractionSettings changes drive UI behaviour (theme, haptics, keep-awake, fonts)
LibraryMulti-Select, Virtual ScrollSelection and scroll systems enable batch operations and performant browsing
Connect P2PRemote Control ModalsCast menu, remote control control modals
DJ ModeDJ Menu ModalDJ configuration modal accessible from player
Sonic AnalysisAnalysis IndicatorsBackground analysis shimmer on audio items
Device MetricsDebug OverlaysReal-time FPS, memory, performance overlays

Error Handling & Reliability

  • Empty stack protection: Attempting to close a modal when none are open is safely ignored
  • Two-stage dismissal: Animations complete before modal is removed from state, preventing visual glitches
  • Auto-close on critical events: When all server sources are removed, source management and login modals close automatically
  • Keep-awake synchronisation: Automatically activated/deactivated with full-screen player lifecycle

Toast Reliability

  • No stacking: Only one toast displays at a time; new toasts dismiss the current one
  • Error persistence: Failure toasts remain on screen until dismissed (no auto-dismiss) so you don't miss critical errors
  • Navigation integration: Toasts with navigation URLs include an arrow button for quick context switching
  • Translation safety: All toast text is translated; missing keys gracefully fall back to default language

Visualizer Reliability

  • Clean lifecycle: Destroy → reinit cycle ensures no resource leaks on quality changes
  • Audio connection management: AnalyserNode connected/disconnected based on playback status
  • Error capture: initialisation failures captured with error messages displayed as toasts
  • Graceful degradation: Falls back to non-WebGL rendering when hardware acceleration unavailable

Selection & Scroll Reliability

  • Context cleanup: Each list must explicitly destroy its context when component is destroyed (prevents memory leaks)
  • Threshold-based updates: Scroll render windows only update when change exceeds threshold (prevents excessive state updates)
  • Map-based selection: O(1) lookups using Map data structure for performance with large selections

Haptics Reliability

  • Availability detection: Plugin availability checked at app initialisation
  • Guard checks: Every haptic trigger verifies both availability and enabled state
  • Settings synchronisation: Haptics enabled state stays in sync with advanced settings automatically

Technical Specifications

SpecificationValueDescription
Modal Types70+Unique modal types for different dialogues
ngFor-Managed Modals22Modals using two-stage dismissal animation
Shared Components50+Reusable UI components
Spinner Animation Types30+Different spinner Visualisation styles
Confirmation Action Types18Distinct destructive/significant actions requiring confirmation
Toast Message Types6Failure, Warning, Threat, Alert, Success, Information
Player Views5Cover, Record, Lyrics, Visualizer, Turntable
Theme Options4Light, Dark, Black, White
Virtual Scroll Buffer10 before, 40 afterItems rendered outside visible area
Scroll Update Threshold5 itemsHalf of RENDER_BUFFER_BEFORE
Toast Duration (Info)5 secondsAuto-dismiss time for non-error toasts
Toast Duration (Error)IndefiniteStays until user dismisses
Long Press Duration300msDuration to trigger long press gesture
Long Press Cancel Distance15pxMax drag distance before cancelling
Visualizer Preset Transition1.2 secondsCrossfade duration between presets
Haptic StylesVariableiOS/Android native haptic patterns
Supported Platforms7iOS, Android, Windows, macOS, Linux