Code
Code displays a code block with optional syntax highlighting and copy functionality
fmt.Println("Hello, World!")Installation
Install the component
templui add codeAdd the JavaScript to your layout
@code.Script()Call this template in your base layout file (e.g., in the <head> section).
Examples
API Reference
Required parameter
Hover for description
Code
API reference for the Code component.
| Name | Type | Default |
|---|---|---|
Unique identifier for the code component | | |
Additional CSS classes to apply to the code container | | |
Additional HTML attributes to apply to the code container | | |
Programming language for syntax highlighting | | |
Additional CSS classes to apply to the code element | | |