Code

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

TailwindCSS

fmt.Println("Hello, World!")

Usage

1. Add the script to your page/layout:

// Option A: All components (recommended)
@utils.ComponentScripts()

// Option B: Just Code
@components.CodeScript()

2. Use the component:

@components.Code(components.CodeProps{...})

Examples

With Copy Button

fmt.Println("Hello, World!")

With Custom Size

package main

import (
   "fmt"
   "log"
   "net/http"
)

func main() {
   http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
       fmt.Fprintf(w, "Hello, World!")
   })

   fmt.Println("Server starting on :3000...")
   if err := http.ListenAndServe(":3000", nil); err != nil {
       log.Fatal(err)
   }
}