Launch Sale: Creator and Business plans are discounted for a limited time. View pricing

Uploader

Drag-and-drop file uploader with progress tracking and theme support.

Usage

Install from npm and import the component, then drop the element into your page. Provide a Client-Side API key and, optionally, a collection ID to upload into. If the API key is scoped to a collection, the collection ID is resolved automatically.

When a file finishes transferring, the component fires file-uploaded with the new trackId. That means the bytes reached storage — not that processing is done. Poll GET /v1/track/:track_id until track_status_id is ready (or listen for a track webhook) before starting playback.

npm install @audiodn/components
import '@audiodn/components/uploader'
<audiodn-uploader
api-key="YOUR_API_KEY"
collection-id="COLLECTION_ID"
></audiodn-uploader>

Prefer no build step? Load it straight from a CDN instead:

<script type="module" src="https://unpkg.com/@audiodn/components@latest/dist/uploader.js"></script>

Attributes

AttributeTypeDefaultDescription
api-keystringClient-Side API key (safe to use in front-end code). Either api-key or upload-session-id is required. When set, the session is automatically renewed before it expires.
upload-session-idstringServer-provisioned upload session ID. Either upload-session-id or api-key is required. Use this when your server creates sessions on behalf of the client.
collection-idstringTarget collection to upload tracks into. Optional when the API key is scoped to a collection.
accent-colorstring”#fe008a”Accent color for the upload progress and buttons. It is automatically tinted (only when needed) to keep a minimum contrast against the active theme’s background, so it stays legible in both light and dark. When omitted, the collection/organization player_color is used.
themestring”auto”Color theme: “dark” (white text on a dark background), “light” (dark text on a soft light-gray background), or “auto”. “auto” follows the visitor’s operating system / browser prefers-color-scheme setting and switches live when it changes. Individual CSS custom properties (see Themes) still override the palette.
disabledbooleanfalseDisables the uploader when set
limitnumber0Maximum number of files that may be uploaded while this component instance is on the page. 0 (or omit) means unlimited. Accepted files count for the lifetime of the element — even after a successful upload leaves the queue — so limit=“1” allows a single upload until the page is refreshed (or you remount the component). Set to 1 also forces single-file picker mode.

Default

Drag-and-drop file uploader with progress tracking. Requires an API key and collection ID.

<audiodn-uploader
api-key="YOUR_API_KEY"
collection-id="COLLECTION_ID"
></audiodn-uploader>

File limit

Use the limit attribute to cap how many files may be uploaded while the component stays on the page. Accepted files count for the lifetime of the element — after a successful upload finishes (and leaves the queue), further selections are still blocked until the page is refreshed or you remount the component. This example allows a single file.

<audiodn-uploader
api-key="YOUR_API_KEY"
collection-id="COLLECTION_ID"
limit="1"
></audiodn-uploader>

Themes

The quickest way to switch light and dark is the theme attribute (“auto”, “dark”, or “light”) documented above — “auto” follows the visitor’s system preference. For finer control you can still override CSS custom properties on the host to restyle the uploader, using the same —adn-* API as the player.

Light / Dark (system preference)

.theme-uploader-lightdark {
--adn-main-border: 1px solid light-dark(#ccc, #444);
--adn-bg: light-dark(#fff, #111);
--adn-bg-light: light-dark(#eee, #222);
--adn-color-font: light-dark(#222, #eee);
--adn-color-font-muted: light-dark(#666, #aaa);
--adn-color-accent: light-dark(#0066cc, #4da6ff);
--adn-color-accent-alt: light-dark(#fff, #111);
--adn-border-color: light-dark(#ccc, #444);
--adn-radius: 6px;
}
<audiodn-uploader
class="theme-uploader-lightdark"
api-key="YOUR_API_KEY"
collection-id="COLLECTION_ID"
></audiodn-uploader>

Midnight

.theme-uploader-midnight {
--adn-bg: #1a1a2e;
--adn-bg-light: #2a2a4e;
--adn-color-font: #e0e0e0;
--adn-color-font-muted: #8888aa;
--adn-color-accent: #7c3aed;
--adn-color-accent-rgb: 124, 58, 237;
--adn-color-accent-alt: #fff;
--adn-border-color: #3a3a5e;
--adn-color-highlight: rgba(124, 58, 237, 0.12);
--adn-radius: 12px;
--adn-main-border: 1px solid #3a3a5e;
--adn-box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}
<audiodn-uploader
class="theme-uploader-midnight"
api-key="YOUR_API_KEY"
collection-id="COLLECTION_ID"
></audiodn-uploader>