Russell20 downloadsPreview HTML mockups from your vault with your plugin's CSS injected into an isolated iframe, for design-time UI prototyping.
A design-time tool for plugin authors. Drop a .html file into your vault and Mockup Viewer renders it inside an isolated iframe with Obsidian's app.css, the active theme, and your plugin CSS all injected — so it looks like the real thing without the build / reload loop.
Iterating on Obsidian plugin UI is painful:
is-phone on Obsidian itself breaks the whole app.Mockup Viewer solves this:
Mockup/foo.html — the preview appears instantly.is-phone / is-keyboard-open / your host classes from leaking onto Obsidian's own chrome.Trust model. Mockup Viewer executes whatever
<script>you put in a mockup. Only open mockups you trust.
Mockup Viewer is not yet listed in Obsidian's community plugins. Use BRAT or manual install below.
BRAT is a community plugin that installs beta plugins directly from GitHub and keeps them updated.
twrusstw/mockup-viewermain.js, manifest.json, styles.css from the latest release<vault>/.obsidian/plugins/mockup-viewer/Desktop only (isDesktopOnly: true).
Command palette → Mockup Viewer: Open panel.
The first run shows an empty state with the inspector panel auto-opened on the right.
Click Add source. Three kinds:
| Kind | Reads from | Use for |
|---|---|---|
plugin:<id> |
.obsidian/plugins/<id>/styles.css |
The plugin you're developing |
vault:<path> |
<vault>/<path> |
Any CSS file inside the vault (drafts, shared styles) |
snippet:<name> |
.obsidian/snippets/<name>.css |
An Obsidian snippet |
Multiple sources allowed. Order matters — later sources override earlier ones via cascade.
Create the folder Mockup/ in your vault (configurable in the panel) and drop .html files into it. Minimal example:
<div class="my-card">
<h2>Hello mockup</h2>
<p>This text picks up your plugin's .my-card styles.</p>
</div>
Save the file — it shows up in the panel's File dropdown. Select it and the preview renders.
Edit either the HTML or the source stylesheet — the preview re-renders within 200 ms. No plugin reload needed.
A .html file can start with a contiguous block of HTML comments to control viewport, shell scaffold (as: modal / settings / etc.), host class, and per-file style sources:
<!-- as: settings -->
<!-- host: my-plugin-settings -->
<!-- viewport: mobile -->
<div class="setting-item">…</div>
Full reference (all directives, shell presets, viewport sizes) → docs/directives.md.
chart.js + chartjs-plugin-datalabels are bundled into the iframe — wire a canvas with data-chart-config='{...}' or use inline <script>. Details → docs/charts.md.
Top to bottom:
.html file dropdown + Reload button to rescan the folderstyles: directive.html files (default Mockup)Click » to collapse the panel. A small « appears in the host so you can bring it back.
One toggle:
Turn this off if a future Obsidian version changes its stylesheet loading mechanism and the mockup breaks. With the toggle off, only your configured sources are injected.
MIT