Overview
GameLibrary is a comprehensive component that renders a virtualized grid of game cards with built-in search, filtering, sorting, and view modes. It’s the primary UI for browsing and managing your game collection.
For libraries larger than 100 games, GameLibrary automatically enables virtualized rendering to maintain 60fps scrolling performance.
Props
Array of games to display in the library
Callback invoked when a user clicks a game card to launch it. Receives the game object and the card’s DOM rect for hero transition animations.
Callback invoked when the user opens the game options menu
Function that returns menu items for a specific game’s dropdown menu. Called dynamically for each card.
Callback invoked when the user toggles the favorite heart icon on a card
External store for per-game artwork sync phases. Each card subscribes to its own phase to show download progress.
ID of the game currently being launched. Shows shimmer effect on that card and disables other cards.
Ref to the scrollable container element. Required for virtualization to work correctly.
Additional CSS classes to apply to the root element
Features
Search and filtering
GameLibrary includes built-in search and platform filtering:- Search - Filters games by title (case-insensitive)
- Platform filter - Shows games for a specific system or all platforms
- Favorites toggle - Filters to show only favorited games
View modes
Two display modes are available:- Grid view - Mosaic layout with cover art (default)
- List view - Compact list with metadata columns
Sorting options
Games can be sorted by:- Title - Alphabetical order
- Platform - Grouped by system
- Last played - Most recently played first
- Recent - Recently added to library
Virtualization
For libraries with more than 100 games, GameLibrary automatically enables virtualized rendering:- Only visible cards are rendered in the DOM
- Reduces DOM nodes from 1200+ to ~40 for large libraries
- Maintains smooth 60fps scrolling performance
- Uses
useMosaicVirtualizerhook under the hood
Flip animations
GameLibrary uses FLIP (First, Last, Invert, Play) animations when games are filtered or re-sorted, creating smooth position transitions.Usage
Basic example
With menu items and favorites
With artwork sync progress
With virtualization
Performance optimizations
GameLibrary includes several performance optimizations:- Virtualized rendering - Only visible cards are in the DOM (>100 games)
- FLIP animations - Smooth transitions without layout thrashing
- Memoized filtering - Search and filter operations are cached
- ResizeObserver - Efficient container width tracking for responsive layout
- Debounced search - Search input is debounced to reduce re-renders
Keyboard navigation
GameLibrary supports keyboard navigation:- Arrow keys - Navigate between cards
- Enter - Launch selected game
- / - Focus search input
- Esc - Clear search
Related components
- GameCard - Individual game card component
- ScrollLetterIndicator - Alphabet scroll indicator for quick navigation
- GameWindow - Component for playing games