Skip to content

Mockup browser

A frame that looks like a browser window, with the window dots and an address bar, around a page preview or a screenshot. Requires Tabler 1.7+.

url is the address in the toolbar, src and alt the screenshot, which fills the width of the frame.

icon goes before the address, such as lock for a secure page. size="sm" gives a 24px toolbar with smaller dots and text, for thumbnails and cards. Without url, the frame only has the window dots:

The body takes any markup, not only an image. Override the body block to keep the toolbar of the props, and add a padding utility to the MockupBrowser:Body:

Children replace the toolbar and the body: MockupBrowser:Toolbar with MockupBrowser:Controls and MockupBrowser:Url, then MockupBrowser:Body. The --tblr-mockup-browser-* variables, in a style attribute, change the colors, the shadow or the size of the dots:

The window dots are an empty element, which screen readers skip. The address is plain text, not a link nor a field. Give a screenshot an alt saying what page it shows.

Prop Type Default Description
url string? null Address in the toolbar; unset, only the window dots
icon string? null Icon before the address, e.g. lock
src string? null Screenshot URL, rendered with MockupBrowser:Body
alt string '' Alternative text of the screenshot
size string? null sm: a 24px toolbar for thumbnails and cards (mockup-browser-sm)

Other attributes go to the root <div class="mockup-browser">.

MockupBrowser:Toolbar takes url and icon, MockupBrowser:Url takes icon (its content is the address), and MockupBrowser:Body takes src and alt. Other attributes go to their root element.

Component Renders
MockupBrowser:Toolbar <div class="mockup-browser-toolbar">: the dots and the address
MockupBrowser:Controls <span class="mockup-browser-controls">: the three window dots
MockupBrowser:Url <div class="mockup-browser-url">: an icon and the address in a <span>
MockupBrowser:Body <div class="mockup-browser-body">: the page
Block Default
toolbar MockupBrowser:Toolbar with the url and icon props
body MockupBrowser:Body with the src and alt props, when src is set
content toolbar and body: replace it to compose freely

MockupBrowser:Toolbar has the controls and url blocks, MockupBrowser:Url an icon block, and MockupBrowser:Body a content block holding the <img> of its props.