You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By default the desktop preview fills the full container width and height (responsive mode). Set `desktop-responsive: false` to use a strict 16:10 contain fit instead — the full 1440 × 900px frame is always visible with no clipping, leaving symmetric gaps above and below when the container is wider than it is tall.
54
+
55
+
<!-- markdownlint-disable MD037 -->
56
+
{{< example-bookshop lang="bookshop" >}}
57
+
58
+
```yml
59
+
- _bookshop_name: preview
60
+
heading:
61
+
title: Strict Aspect Ratio
62
+
content: Full 1440×900px frame always visible, no clipping
Use `cover: true` and `fluid: true` for a full-width preview layout, ideal for showcasing responsive designs.
@@ -156,39 +176,58 @@ This allows embedding localhost sites during development while maintaining secur
156
176
157
177
## Device dimensions
158
178
159
-
The preview component uses **fixed widths** and **flexible heights**:
179
+
Device dimensions use **logical pixels** (CSS pixels), which is what browsers and responsive design tools use for layout. Physical pixels depend on the device pixel ratio (DPR) of the hardware display.
A website loaded inside the iframe sees a viewport matching these logical pixel dimensions, so breakpoints and responsive layouts behave exactly as they would on the real device.
166
188
167
-
```scss
168
-
height: calc(100vh - controls - navbar - margins)
169
-
min-height: 400px
189
+
### Auto-scaling
190
+
191
+
JavaScript scales each device on page load and on every browser resize. Tablet and mobile always use a **contain fit** — the largest scale where neither dimension is clipped:
Content within panels scrolls vertically when it exceeds the panel height.
197
+
Desktop scaling depends on the `desktop-responsive` argument:
198
+
199
+
| Mode | `desktop-responsive` | Behaviour |
200
+
|------|----------------------|-----------|
201
+
| Responsive (default) | `true` | Scales to fill the full container width; iframe height is adjusted dynamically so the container height is also filled. The site inside sees a 1440px-wide viewport. |
202
+
| Strict aspect ratio | `false` | Contain fit — the full 1440 × 900px frame is always visible; symmetric gaps may appear above and below on wide containers. |
203
+
204
+
The zoom recalculates on page load and whenever the browser window is resized.
205
+
206
+
**Container height** adapts to available viewport space and is capped so tall devices
207
+
(tablet: 1180px logical) are never rendered beyond the available screen area:
The component automatically shows or hides device previews **based on viewport width only**:
177
218
178
-
- **Small screens (< 768px)**: Mobile preview only
179
-
- **Medium screens (768px-1199px)**: Tablet and mobile previews
180
-
- **Large screens (≥ 1200px)**: All three previews
181
-
182
-
**Height does not affect panel visibility** - panels adjust their height to fit the viewport, and content scrolls if needed.
219
+
- **Small screens (< 640px)**: Mobile preview only
220
+
- **Medium screens (640px–1023px)**: Tablet and mobile previews
221
+
- **Large screens (≥ 1024px)**: All three previews
183
222
184
223
Buttons for hidden device views are automatically hidden from the control bar, and the active view automatically switches when a panel becomes unavailable.
185
224
186
225
### Container constraints
187
226
188
-
Desktop preview (1200px width) works best with:
227
+
In responsive mode (default), the desktop preview fills whatever container it is placed in. For best results with `desktop-responsive: false` or when using `cover: true`:
189
228
190
-
- `fluid: true` or `width: 12` for full-width layouts
191
-
- Container-xxl or larger for proper display
229
+
- Use `fluid: true` or `width: 12` for full-width layouts
230
+
- Use a container at least as wide as the desired desktop zoom level
0 commit comments