sigilUI

Sigil View Code

Toggle between a live demo and the source code that produced it.

@sigil-ui/componentsReact

Preview

View or inspect source Interactive

Import

import { SigilViewCode } from "@sigil-ui/components";

Usage

Use SigilViewCode for demos, examples, and docs pages where readers need both the rendered surface and the implementation.

<SigilViewCode code={source}>
  <DemoTemplate />
</SigilViewCode>

The component owns the view/code switcher so demo pages do not need local tab state, local toolbar markup, or one-off code panels.

Props

PropTypeDefaultDescription
codestring—Source code to render in code mode
defaultView"preview" | "code""preview"Initial mode
previewLabelstring"View"Label for preview tab
codeLabelstring"Code"Label for source tab