@fluid-app/dam-picker npm package to embed Fluid’s Digital Asset Management (DAM) file picker into your application. The SDK provides a drop-in modal for browsing, searching, and uploading assets, with support for React and vanilla JavaScript.
Overview
The DAM Picker SDK lets you add a full-featured asset picker to any web application. Users can browse the DAM library, upload files from their computer, import from URLs, and search Unsplash — all within a single modal. When a user makes a selection, your application receives structured asset data including the public URL, asset code, MIME type, and optional metadata. The SDK works with any frontend framework. First-class React bindings are included, and the vanilla JavaScript API integrates cleanly with Vue, Angular, Svelte, or plain HTML pages.Installation
Install the package from npm using your preferred package manager:Prerequisites
You need a Fluid API token to authenticate the picker. This is the same token used for other Fluid API integrations. See the Authentication guide for details on obtaining a token.Quick Start
Choose the integration style that matches your stack.- Vanilla JavaScript
- React (Hook)
- React (Controlled)
Configuration
DamPicker Options
TheDamPicker constructor and DamPickerModal component accept the following options:
Asset Type Filtering
Restrict the picker to specific asset types using thefilters.assetTypes option:
Multi-Select
By default, users can select one asset at a time. SetmaxSelectable to allow multiple selections:
onSelect always receives an array of SelectedAsset[], even when maxSelectable is 1. For single-select, access the asset with assets[0].Selected Asset Structure
When a user makes a selection,onSelect receives an array of SelectedAsset objects:
Example: Using the Selected Asset
Error Handling
TheonError callback receives a DamPickerError with a machine-readable code and a human-readable message:
Instance Methods
TheDamPicker class exposes these methods:
Always call
destroy() when you’re done with the picker to prevent memory leaks:
Upload Behavior
When users upload a file (either from their computer or via URL), the file is uploaded to Fluid’s DAM. Once the upload completes, theonSelect callback fires with the new asset — no separate upload handling is needed. The picker automatically closes after a successful upload.
Framework Integrations
The vanilla JavaScript API works with any framework. These examples show common integration patterns — create the picker on mount and calldestroy() on teardown.
Common Use Cases
Product Image Selector
Gallery Builder
Document Attachment
Local Development
For local development, point the SDK to your localfluid-admin instance:
Troubleshooting
Picker does not open
- Verify your API token is valid and not expired. An invalid token triggers the
onErrorcallback withAUTHENTICATION_ERROR. - Check the browser console for JavaScript errors.
- Ensure the
@fluid-app/dam-pickerpackage is installed and imported correctly.
Picker opens but shows a blank screen
- Check network connectivity. The picker loads inside an iframe from
admin.fluid.app. - If using a corporate network or VPN, ensure
admin.fluid.appis not blocked. - The
onReadycallback should fire when the picker is loaded. If it doesn’t, there may be a network issue.
Timeout errors
- The picker has a 10-second load timeout. On slow connections, this may not be enough.
- Check that
admin.fluid.appis reachable from the browser.
onSelect returns an empty array
- This should not happen under normal operation. If it does, check the browser console for errors and ensure you’re on the latest SDK version.
Multi-select not working
- Confirm you’re passing
maxSelectablewith a value greater than 1. - The picker UI will show a different selection mode when
maxSelectable > 1.
Content Security Policy (CSP) issues
If your application uses a strict CSP, you need to allow the picker iframe:Related Guides
- Authentication guide — How to obtain and manage API tokens