Getting Started
Overview
Installation
Theme
Forms
Basic Inputs
Custom Inputs
Select
Components
Components
78
Micro Charts
Navigation
Libraries
Content Editor
Data View
Form Builder
Image Designer
Kanban Board
PDF Viewer
Video Player
Latest npm version of @ngstarter-ui/componentsWeekly npm downloads of @ngstarter-ui/components
Buy License

Code Highlighter

Code Highlighter shows read-only source code with syntax highlighting. Use it for documentation snippets, API examples, configuration blocks, code previews, and small diffs that users need to read or copy.

Use it for:
  • Showing code examples in documentation, onboarding screens, or developer tools.
  • Displaying a filename or title above a code block.
  • Highlighting important lines or ranges inside a snippet.
  • Showing added and removed lines in a compact diff view.
  • Letting users copy code with an optional copy button.

Do not use Code Highlighter as a code editor, textarea, terminal log, markdown article, or general text container. It is only for displaying code that is not edited in place.

API Reference

Properties for the ngs-code-highlighter component.

PropTypeDefault
code*
The source code to be highlighted.
string
language
The language for syntax highlighting.
stringnone
theme
The Shiki theme to use.
stringgithub-light
title
The title displayed above the code block.
string | nullnull
appearance
The visual appearance of the code block.
'none' | 'bordered'bordered
diff
Whether to enable diff mode highlighting.
booleanfalse
highlightLines
Specific lines or ranges to highlight.
number[] | number[][][]
showLanguage
Whether to display the language label.
booleanfalse
showCopyButton
Whether to show the copy to clipboard button.
booleanfalse
disableOverflow
Whether to disable the internal overflow container so a parent scroll area can own scrolling.
booleanfalse