Development Demo & Integration Guide - A self-contained, embeddable JavaScript component for displaying real-time image galleries
This page serves two purposes:
To add the LiveDab Gallery Widget to your website, simply add these two elements:
<div livedab-stream-id="YOUR_STREAM_ID"></div>
<body>:
<script type="module" crossorigin src="https://stream.livedab.com/assets/index.js"></script>
The widget script tag includes two important attributes:
| Attribute | Required? | Why It's Needed |
|---|---|---|
type="module" |
Yes |
The widget is built as an ES module using modern JavaScript.
This attribute tells the browser to load it as a module,
enabling:
|
crossorigin |
Recommended |
Enables proper CORS (Cross-Origin Resource Sharing) handling
when loading from a CDN:
|
type="module") are supported in all modern
browsers: Chrome 61+, Firefox 60+, Safari 11+, Edge 16+. This covers
98%+ of users. Internet Explorer is not supported.
The widget is configured using HTML attributes on the container element:
| Attribute | Description | Example |
|---|---|---|
livedab-stream-id |
Your unique gallery stream ID (required) | livedab-stream-id="6908e52a36ff006e1cb46633" |
| Attribute | Description | Default | Example |
|---|---|---|---|
data-api-url |
Custom API base URL for fetching gallery data | Environment default | data-api-url="https://api.mysite.com" |
data-polling-interval |
Auto-refresh interval in milliseconds | 5000 (5 seconds) | data-polling-interval="3000" |
data-max-items |
Maximum number of items to display | Unlimited | data-max-items="20" |
data-polling-interval="0" to disable automatic
polling. The gallery will only fetch data once on load.
The simplest possible integration with a single gallery:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>My Gallery</title>
</head>
<body>
<h1>Welcome to My Gallery</h1>
<!-- Gallery Widget -->
<div livedab-stream-id="6908e52a36ff006e1cb46633"></div>
<!-- Widget Script -->
<script type="module" crossorigin src="https://stream.livedab.com/assets/index.js"></script>
</body>
</html>
You can embed multiple galleries by adding multiple container elements:
<body>
<h1>Event Photo Galleries</h1>
<h2>Conference 2024</h2>
<div livedab-stream-id="6908e52a36ff006e1cb46633"></div>
<h2>Workshop Sessions</h2>
<div livedab-stream-id="691249af13b49484f969228c"></div>
<script type="module" crossorigin src="https://stream.livedab.com/assets/index.js"></script>
</body>
Point the widget to your custom API endpoint:
<div
livedab-stream-id="6908e52a36ff006e1cb46633"
data-api-url="https://api.mycompany.com"
></div>
<script type="module" crossorigin src="https://stream.livedab.com/assets/index.js"></script>
Refresh every 3 seconds instead of the default 5 seconds:
<div
livedab-stream-id="6908e52a36ff006e1cb46633"
data-polling-interval="3000"
></div>
<script type="module" crossorigin src="https://stream.livedab.com/assets/index.js"></script>
The widget doesn't interfere with your page styles, so you can style the container:
<style>
.gallery-wrapper {
max-width: 1200px;
margin: 40px auto;
padding: 20px;
background: #f5f5f5;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
</style>
<div class="gallery-wrapper">
<h2>Latest Photos</h2>
<div livedab-stream-id="6908e52a36ff006e1cb46633"></div>
</div>
<script type="module" crossorigin src="https://stream.livedab.com/assets/index.js"></script>
Load the gallery once without automatic updates:
<div
livedab-stream-id="6908e52a36ff006e1cb46633"
data-polling-interval="0"
></div>
<script type="module" crossorigin src="https://stream.livedab.com/assets/index.js"></script>
livedab-stream-id attribute
The widget requires two modern browser features:
| Browser | Minimum Version | Release Date |
|---|---|---|
| Chrome | 63+ | December 2017 |
| Firefox | 63+ | October 2018 |
| Safari | 11.1+ | March 2018 |
| Edge | 79+ | January 2020 |
| Opera | 50+ | January 2018 |
Coverage: This covers >98% of all web users worldwide. Internet Explorer is not supported.
livedab-stream-id attribute
to your container element
<script> tag after
your container elements, ideally at the end of the
<body>.
For more detailed information, see:
Below are two live instances of the widget running in development mode. Notice how each widget is completely isolated with its own Shadow DOM:
src/main.tsx for hot-reloading during
development. In production, you'll use the compiled
widget.js bundle instead.
Stream ID: 694925aade854feb27ffa8f7
LiveDab Realtime Gallery Widget v0.0.0
Built with React, TypeScript, TailwindCSS, and Framer Motion