Interactive Demos

Explore all the features of the <browser-window> component

Basic Usage with Source Viewing

Load external HTML with the src attribute. Click the </> icon to view the source code!

<browser-window src="flexbox-demo.html" url="https://example.com/flexbox" shadow> </browser-window>

Light & Dark Mode

Use mode="light" or mode="dark" to pin the theme. These components ignore the page theme toggle.

This window is always light

This window is always dark

<browser-window mode="light" url="https://example.com" title="Light Mode"> <div class="content">Always light</div> </browser-window> <browser-window mode="dark" url="https://example.com" title="Dark Mode"> <div class="content">Always dark</div> </browser-window>

Page-Level Dark Mode Detection

When no mode attribute is set, the component automatically follows page-level dark mode signals. Click the theme toggle button (🌓) in the top-right corner and watch these components switch themes automatically.

No mode attribute — follows page theme

mode="light" — stays light always

<!-- Automatically follows page theme toggle --> <browser-window url="https://example.com" title="Auto Theme"> ... </browser-window> <!-- Pinned to light — ignores page theme --> <browser-window mode="light" url="https://example.com" title="Always Light"> ... </browser-window>

Detected signals: body.dark class (Tailwind/docs sites), data-theme="dark", data-bs-theme="dark" (Bootstrap 5), data-mode="dark" (Vanilla Breeze), and color-scheme: dark computed style.

Resizable

Drag the bottom-right corner to resize. The component respects min-width and min-height constraints.

Drag the corner to resize!

<browser-window url="https://example.com" title="Resize Me!" style="height: 300px"> <div class="content">Drag the corner to resize!</div> </browser-window>

Slotted Content

When no src is provided, use slotted content directly. Great for screenshots or custom HTML.

Dashboard

Welcome back! Your stats are looking great.

<browser-window url="https://myapp.example.com" title="My App Dashboard" shadow> <div class="card-content"> <div class="card"> <h3>Dashboard</h3> <p>Welcome back! Your stats are looking great.</p> </div> </div> </browser-window>

Maximize Mode

Double-click the header or click the green button to maximize. Press Escape or click the overlay to restore.

<!-- Double-click header or click green button to maximize --> <browser-window src="demo.html" url="https://example.com" title="Maximize Me!"> </browser-window>

Custom Theming

Use CSS custom properties to create custom themes.

Custom purple theme using CSS custom properties

.purple-theme { --browser-window-accent-color: #8b5cf6; --browser-window-bg: #faf5ff; --browser-window-header-bg: #f3e8ff; --browser-window-border-color: #c4b5fd; --browser-window-url-bg: #faf5ff; --browser-window-hover-bg: #ede9fe; --browser-window-content-bg: #f5f3ff; --browser-window-text-color: #4c1d95; --browser-window-text-muted: #6d28d9; --browser-window-close-color: #f472b6; --browser-window-minimize-color: #a78bfa; --browser-window-maximize-color: #34d399; } <browser-window class="purple-theme" mode="light" url="https://example.com"> ... </browser-window>

Device Mode

Wrap content in realistic phone and tablet bezels using the device attribute. Includes status bars, notches, Dynamic Islands, and home indicators that match real devices.

iPhone 16

Dynamic Island, home indicator, and rounded corners.

<browser-window device="iphone-16" src="mobile-demo.html"> </browser-window>

Device Presets

Choose from a range of devices. Each preset matches real device dimensions, corner radius, and chrome style.

iphone-se
pixel-9
galaxy-s24
<browser-window device="iphone-se" src="demo.html"></browser-window> <browser-window device="pixel-9" src="demo.html"></browser-window> <browser-window device="galaxy-s24" src="demo.html"></browser-window>

Landscape Orientation

Add orientation="landscape" to rotate the device. Dimensions and chrome positions are swapped automatically.

<browser-window device="iphone-16" orientation="landscape" src="mobile-demo.html"> </browser-window>

Bezel Colors

Use device-color to change the bezel finish: midnight (default), silver, gold, blue, or white.

midnight
silver
gold
<browser-window device="iphone-16" device-color="silver" src="demo.html"> </browser-window>

Safe Area Overlays

Add show-safe-areas to visualize the safe area insets — useful for teaching responsive mobile design.

<browser-window device="iphone-16" show-safe-areas src="mobile-demo.html"> </browser-window>

Tablet

Tablet presets like ipad-air render at their native dimensions, scaled to fit the container.

<browser-window device="ipad-air" src="demo.html"> </browser-window>

Available Device Presets

Preset Screen Notch Home
iphone-16393 × 852Dynamic IslandIndicator
iphone-16-pro-max440 × 956Dynamic IslandIndicator
iphone-se375 × 667NoneButton
pixel-9412 × 923Punch-holeIndicator
pixel-9-pro-xl448 × 998Punch-holeIndicator
galaxy-s24360 × 780Punch-holeIndicator
ipad-air820 × 1180NoneIndicator
ipad-pro-131024 × 1366NoneNone

All Features