Ship faster with goilerplate templUI Pro

Code

Code displays a code block with optional syntax highlighting and copy functionality

Source Tailwind CSS JavaScript

fmt.Println("Hello, World!")

Installation

  1. Install the component

    templui add code
  2. Add the JavaScript to your layout

    @code.Script()
    

    Call this template in your base layout file (e.g., in the <head> section).

Examples

Copy Button

fmt.Println("Hello, World!")

API Reference

Required parameter
Hover for description

Code

API reference for the Code component.

Name Type Default
ID
string
code-{randomID}
Class
string
""
Attrs
templ.Attributes
nil
Language
string
""
CodeClass
string
""