Overview
Albums is a production-ready album viewer resource included in the sunpeak framework. It displays photo albums in a carousel layout with the ability to open albums in fullscreen mode for detailed photo browsing. The component automatically switches between inline and fullscreen display modes.
The resource retrieves album data from useWidgetProps() and manages selection state with useWidgetState().
Data Structure
AlbumsData
The resource expects data in the following format viauseWidgetProps():
Array of album objects to display.
Unique identifier for the album.
Album title displayed on the album card.
URL to the album cover image.
Array of photos in the album.
Unique identifier for the photo.
Photo title or caption.
URL to the full-resolution photo.
Display Modes
The Albums resource has two display modes:Inline Mode (Default)
Displays albums in a horizontal scrolling carousel with album cards showing the cover image and photo count.Fullscreen Mode
When a user selects an album, the resource:- Sets the selected album ID in widget state using
useWidgetState(). - Requests fullscreen mode via
useWidgetAPI(). - Displays a fullscreen photo viewer with:
- Film strip navigation (desktop only).
- Large centered photo display.
- Automatic selection reset when switching albums.
State Management
The resource usesuseWidgetState to persist the selected album across sessions:
Features
Safe Area Support
Respects device safe areas usinguseSafeArea() to ensure proper padding on devices with notches or rounded corners.
Height Constraints
UsesuseMaxHeight() to adapt to available screen space and prevent overflow.
Common Use Cases
- Photo gallery applications
- Portfolio viewers
- Image collection browsing
- Media library interfaces