Content

CodeHighlight

Display source code with syntax highlighting, a title, and a copy button.

Basic usage

Pass the original text to code and choose a language for highlighting. Enable copyable to let readers copy the snippet and localize the labels as needed.

example.tsx
import { Button } from "@egcs/newui/actions";

<Button variant="soft">Save</Button>;

API

Key props and defaults.

PropValues and behaviorDefault
codestringrequired
languagetext, bash, css, html, javascript, json, typescript, jsx, tsxtext
titlestring—
copyablebooleanfalse
copyLabel / copiedLabel / copyErrorLabelstring—