Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Sprite ¶
type Sprite struct {
// contains filtered or unexported fields
}
Sprite holds SVG icon definitions for server-side sprite sheet injection. Build with New() and chain Add() calls. assetmin injects Sprite.String() inline at the top of <body>.
func (*Sprite) Add ¶
Add registers an icon. id: referenced in Icon("id") and <use href="#id"> content: inner SVG (NOT the wrapping <svg> tag) — must use fill="currentColor" viewBox: optional, defaults to "0 0 16 16"
type SvgProvider ¶
type SvgProvider interface {
IconSvg() *Sprite
}
SvgProvider is an optional capability: components that expose SVG icons for the global sprite sheet injected inline in <body> during SSR.
Implement in a component's svg.go file (//go:build !wasm).
Example in mycomponent/svg.go:
//go:build !wasm
package mycomponent
import "github.com/tinywasm/svg"
func (c *MyComponent) IconSvg() *svg.Sprite {
return svg.New().
Add("my-icon", `<path fill="currentColor" d="M0 0l16 16z"/>`)
}
Click to show internal directories.
Click to hide internal directories.