components

package module
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 7, 2026 License: MIT Imports: 3 Imported by: 0

README

tinywasm/components

Project Badges

HTML components for the go web framework tinywasm

Architecture: SSR/WASM Separation

To avoid bloating the WebAssembly binary with styles and server-side logic, components should be split into shared and backend-only files:

  • component.go: Shared struct definition, HandlerName(), and RenderHTML().
  • ssr.go (or back.go): Backend-only methods like RenderCSS() and RenderJS(). Must include //go:build !wasm.
  • front.go: WASM-only methods like OnMount() and OnUnmount(). Must include //go:build wasm.

See the Component Creation Guide for detailed instructions.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CssVars added in v0.0.4

type CssVars struct {
	Primary            string `css:"--color-primary"`
	Secondary          string `css:"--color-secondary"`
	Tertiary           string `css:"--color-tertiary"`
	Quaternary         string `css:"--color-quaternary"`
	Gray               string `css:"--color-gray"`
	Selection          string `css:"--color-selection"`
	Hover              string `css:"--color-hover"`
	Success            string `css:"--color-success"`
	Error              string `css:"--color-error"`
	MenuWidthCollapsed string `css:"--menu-width-collapsed"`
	MenuWidthExpanded  string `css:"--menu-width-expanded"`
}

CssVars defines the structure for the site's CSS variables.

func GetDefaultCssVars added in v0.0.4

func GetDefaultCssVars() CssVars

GetDefaultCssVars returns the default CSS variables.

func (CssVars) Render added in v0.0.4

func (c CssVars) Render() string

Render returns the CSS variables as a string (e.g. key: value;).

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL