Code#

MockupCode renders a dark terminal-style block. Feed it lines — each with an optional prompt prefix and colour — or supply your own <pre> elements as children. It is also available as Mockup.Code.

Import#

TSX
import { MockupCode } from '@sigx/daisyui';
// or
import { Mockup } from '@sigx/daisyui';

Basic Usage#

TSX
Loading preview...

Multiple Lines with Colours#

prefix is rendered as the line's gutter text; color tints the line with a theme colour.

TSX
Loading preview...

Custom Children#

When you pass children they replace lines entirely. Use data-prefix on each <pre> for the gutter, and DaisyUI's bg-* / text-* classes to highlight a whole line.

TSX
Loading preview...

Props#

PropTypeDefaultDescription
linesCodeLine[]-Lines to render when no children are given
classstring-Additional CSS classes

CodeLine#

FieldTypeDescription
prefixstringGutter text ($, >, a line number, …)
textstringLine content
color'primary' | 'secondary' | 'accent' | 'info' | 'success' | 'warning' | 'error'Text colour for the line

Slots#

SlotDescription
defaultCustom <pre> lines; replaces lines when present