Preview

Use Preview to show a rendered example and its source in standard Basecoat tabs. In MDX documentation pages, the Code tab shows the source written inside the component.

Usage

<Preview lang="html">
  <button type="button" class="btn">Save changes</button>
</Preview>

Options

PropTypeDefaultNotes
codestringGenerated from childrenOptional source override for the Code tab.
langstring"html"Language passed to Shiki.
titlestring"Preview"Label for the rendered-example tab.
classstring""Extra classes on the preview canvas.

Outside MDX documentation pages, pass the source explicitly with code. Use ordinary classes such as flex items-center justify-center to position the example. Scripts and other example behavior are authored by the page, using normal MDX or imported components.

Examples

Button