Skip to main content
brickwork
GitHub Log in Get started
Display
Theme
Density
Direction
Brand

Documentation

Preview frame

A guarded viewport for live UI specimens.

All components Component Brickwork 4.3.1

Try it

Scrollable specimen

Open full-page preview

A long shell preview.

<main><h2>Account settings</h2></main>
Account settings
Use to present rendered interface inside documentation or a gallery.

Use it

Working invocation

This code creates the configuration shown above. Copy the template and the required Python context together.

templates/your_app/component.html

Django template

{% include "brickwork/components/_preview_frame.html" with content=preview_html caption=caption scrollable=scrollable %}

your_app/views.py

Python

context = {'preview_html': '<main><h2>Account settings</h2></main>', 'caption': 'Account settings', 'scrollable': True}

Guide

Add it to your project

  1. Pass safe pre-rendered `content`, or extend the template and fill `preview`.
  2. Set `scrollable` only for genuinely tall specimens.

View this component's source for the installed release

Options

Public API

Option Type Default Required Description
content safe HTML Not set No Included live markup; the preview block wins when extending. Constraint: Pass only pre-rendered, trusted SafeString markup; do not mark request data safe.
caption string Not set No Figure caption. Constraint: Describe the specimen when a visible figure caption adds context.
scale string full No Presentation scale. Allowed: full, card. Constraint: Use `full` for 1:1 inspection or `card` for a thumbnail-scale specimen.
scrollable boolean False No Caps and makes the viewport scrollable. Constraint: Enable only for a genuinely tall specimen so the normal frame remains compact.

Named blocks

Fill these only when you extend the component template. They are not values passed to an include or tag.

Block What it replaces
preview Trusted live preview markup; this takes precedence over `content` when extending. Constraint: Markup-only extension seam; passing a context variable with this name is ignored.

Behaviour

Accessibility and responsive behaviour

Accessibility
The viewport is a labelled region and becomes keyboard-focusable when scrollable.
Responsive
Card scale remains transform-based; scroll cap is constant.
Without JavaScript
A normal framed region.

Need help?

Troubleshooting

Contract check: include path. Prefer a pre-rendered SafeString from the view.

Pass trusted pre-rendered content or fill the `preview` block; never mark request data safe for display in the frame.

Documentation