Early Access

Usage

API Reference

CodePreview.Root

PropTypeDefaultDescription
code*stringThe source code string to display in the Code tab and to copy.
defaultView"preview" | "code""preview"Which tab is active on initial render.
unstyledbooleanfalseStrip all default styles from all sub-components.

CodePreview.Tab

PropTypeDefaultDescription
view*"preview" | "code"Which panel this tab activates when clicked.
iconReactNodeOptional icon rendered before the tab label.

CodePreview.CopyButton

PropTypeDefaultDescription
copyLabelstring"Copy Code"Label shown in idle state.
copiedLabelstring"✓ Copied"Label shown for 2 seconds after copying.