Skip to main content

CodeHighlighter

Used to highlight segments of code.

Submit feedback
github
import { CodeHighlighter } from '@uhg-abyss/web/ui/CodeHighlighter';
<CodeHighlighter code="console.log('hello world!');" language="js" />

Language

Use the language prop to set the desired language for highlighting. See the following documentation for the complete list of supported languages and their corresponding values. Default value is set to jsx (React JSX).

Show line numbers

Use the showLineNumbers prop to display line numbers within your highlighted code block.

CodeHighlighter Props

Prop NameTypeDefaultDescription
codestringThe code to be highlighted
languagestringjsxThe type of coding language to highlight
showBorderbooleantrueDisplay border around code block
showLineNumbersbooleanfalseDisplay line numbers
themeshape-The theme used for the highlighter

CodeHighlighter Classes

Class NameDescription
.abyss-code-highlighter-rootCodeHighlighter root element
Table of Contents