This plugin allows you to seamlessly integrate the Pexels API into your Bubble application, providing easy access to high-quality, royalty-free images and videos. It supports advanced features such as pagination, LRU caching, infinite scrolling (“Load More”), and intelligent pre-fetching to enhance performance.
Enable easy search and display of royalty-free images and videos from Pexels.
Provide built-in support for pagination and incremental content loading ("Load More").
Optimize performance with LRU caching and prefetching for faster load times.
Offer flexible filtering (orientation, size, color, locale).
Expose various states for easy integration into Bubble workflows and UI elements.
Field | Type | Description | Default |
---|---|---|---|
search_term | Text | Search term to query. Defaults to "popular" if empty. |
"popular" |
results_count | Number | Number of results per page (images/videos). | 25 |
load_more | Boolean | Load next page results when switched from false to true . |
false |
search_type | Text | "images" or "videos" . Defaults to "images" if invalid or empty. |
"images" |
orientation | Text | (Images only) "landscape" , "portrait" , "square" . |
"" |
size | Text | (Images only) "large" , "medium" , "small" . |
"" |
color | Text | (Images only) Color name or hexadecimal code. | "" |
locale | Text | Locale code (e.g. "en-US" , "es-ES" ). Defaults to browser locale. |
Browser auto |
Use these states to seamlessly integrate results into your Bubble app's workflows and UI:
State | Type | Description |
---|---|---|
image_results | List | URLs of returned images (src.medium). |
image_names | List | Descriptive text (e.g. “Photo by John Doe”). |
image_sizes | List | Height of images in pixels. |
video_results | List | URLs of HD or best available video files. |
video_names | List | Descriptive text (e.g. “Video by Jane Smith”). |
video_sizes | List | Video heights in pixels. |
video_thumbnails | List | Thumbnail images provided by Pexels or dynamically generated. |
error_message | Text | Error messages when API calls fail or return no results. |
current_page | Number | Current page number displayed. |
total_results_shown | Number | Total accumulated results displayed. |
has_more_results | Boolean | Indicates if more pages are available to load. |
total_results_available | Number | Total number of results available from Pexels. |
New Search
Changing search_term
, search_type
, or filters resets cache/results and loads Page 1.
Load More
Setting load_more
to true
increments current_page
and loads next page results.
After results load, you must reset load_more
back to false
.
Prefetching (Optional)
The plugin preloads the next page in the background for faster loading when available.
Image Galleries: Display grids or sliders with curated or user-driven searches.
Dynamic Backgrounds: Set sections with regularly updated images (e.g., "nature," "business").
Video Carousels: Embed video previews with integrated thumbnails and play buttons.
Multi-language Searches: Retrieve localized results using the locale
parameter.
Infinite Scroll: Implement seamless paginated content loading for better UX.
Sign up at Pexels API.
Create a new application in your dashboard to receive an API key.
In Bubble, navigate to Settings → API Keys and save your API key securely.
Assign your Bubble-stored API key to the api_key_pexels
field under context.keys in the plugin settings.
Ease of Integration: Quickly set up powerful image and video searches.
Performance Optimization: Efficient caching and prefetching reduce API load and improve response times.
Flexible Customization: Wide range of filtering options for precise content control.
Enhanced User Experience: Smooth content loading and clear error management.
Bubble Integration: Exposed states facilitate direct workflow integration for rapid UI/UX development.
Installation
Install the Pexels Media Search Plugin in your Bubble editor.
Adding the Element
Drag the plugin element onto your Bubble page.
API Key Setup
Select your saved API key from Settings → API Keys within the plugin properties.
Configuring Fields
Enter your desired values for search_term
, results_count
, search_type
, and optional filters.
Creating a Repeating Group
Set up a Repeating Group to display image_results
or video_results
.
Inside each cell, place an Image or Video element linked to Current cell’s image_results:item# or similar states.
Implementing "Load More" Functionality
Create a “Load More” button that triggers a workflow:
Set plugin property load_more
= true
.
After a brief delay, reset load_more
= false
.
Error Handling
Display the error_message
state in a Text element to inform users about any API issues or empty results.
Advanced Experience
Use conditional workflows triggered by the has_more_results
state to hide or show pagination or load more buttons.
Was this page helpful?
Thank you for your feedback!
Please Login First
Comments (00)