HighlightCompo Component

Key Features

  • ✓ Copy to Clipboard - One-click code copying with visual feedback
  • ✓ Auto Expand/Collapse - Automatically adds expand button for code over 18rem height
  • ✓ Multi-Language - Supports JavaScript, TypeScript, JSON, YAML, Markdown, Svelte, and more
  • ✓ Syntax Highlighting - Powered by highlight.js for accurate code coloring
  • ✓ Optional Line Numbers - Add with numberLine=true
  • ✓ Highlighted Lines - Emphasize specific lines with highlightedLines=[1,3,5]
  • ✓ Language Tags - Show language label with langtag=true

JavaScript - Copy Functionality Demo

Try clicking the "Copy" button in the top-right corner. You'll see feedback: "✓ Copied!" or "✗ Failed"

TypeScript - Type Definitions

Full TypeScript syntax highlighting support with interfaces, types, and generics

JSON - Configuration Example

Perfect for displaying API responses and configuration files

YAML - Config Files

Great for CI/CD configs, Docker Compose, and deployment files

Markdown - Documentation

Display formatted documentation with code blocks and syntax highlighting

Svelte - Component Examples

Show Svelte component code with runes, props, and reactive statements