Versions in this module Expand all Collapse all v0 v0.1.0 Aug 11, 2026 Changes in this version + const ChildrenDataKey + const ContextKey + const DefaultActionPrefix + const FlagComponent + const FlagDynamicTag + const FlagFragment + const FlagHasChildren + const FlagRaw + const FlagSelfClosing + const FlagText + const FlagVoid + const HXBoosted + const HXCurrentURL + const HXHistoryRestoreRequest + const HXLocation + const HXPrompt + const HXPushURL + const HXRedirect + const HXRefresh + const HXReplaceURL + const HXRequest + const HXReselect + const HXResettle + const HXReswapHeader + const HXRetarget + const HXTarget + const HXTrigger + const HXTriggerAfterSettle + const HXTriggerAfterSwap + const HXTriggerHeader + const HXTriggerName + const SlotsDataKey + var ErrEngineNotFound = errors.New("render: engine not found") + var ErrLayoutMissing = errors.New("render: layout missing") + var ErrLoaderMissing = errors.New("render: no loader on context") + var ErrRenderPageInvalid = errors.New("render: invalid render page") + var ErrTemplateNotFound = errors.New("render: template not found") + var ErrValidation = errors.New("render: validation error") + func BindProps[T any](data any) T + func CheckConditional(rc *RenderContext, p *Program) bool + func ClearRenderState() + func CurrentURL(r *http.Request) string + func Execute(p *Program, w ByteWriter, rc *RenderContext, data any) error + func HXPromptResponse(r *http.Request) string + func HXTargetID(r *http.Request) string + func HXTriggerID(r *http.Request) string + func HashContent(p *Program) string + func IsHTMXBoosted(r *http.Request) bool + func IsHTMXHistoryRestore(r *http.Request) bool + func IsHTMXRequest(r *http.Request) bool + func IsVoidTag(tag string) bool + func MinifyHTML(src []byte, cfg MinifyConfig) ([]byte, error) + func Props[T any](c *ComponentContext) T + func ReleaseContext(rc *RenderContext) + func ReleasePerFlushWriter(pw ByteWriter) + func ReleaseWriter(w ByteWriter) + func RenderComponent(ctx context.Context, w io.Writer, name string, props any) error + func SetFlusher(w ByteWriter, f http.Flusher) + func SetRenderState(rc *RenderContext) + func SuperpowerFuncs() template.FuncMap + func TriggerName(r *http.Request) string + func UseContextFunc(rc *RenderContext) any + func UseStateOrDefault[T any](s *State, key string) (T, bool) + func UseState[T any](s *State, key string, initial T) (T, func(T)) + func WithContext(ctx context.Context, rc *RenderContext) context.Context + type ActionFunc func(rc *RenderContext, props map[string]any) error + type ActionProvider interface + LookupAction func(name string) (ActionFunc, bool) + type AsyncOptioner interface + AsyncFallback func() (id string, render func(w ByteWriter, rc *RenderContext, data any) error) + type AttrKV struct + K string + V string + type ByteWriter interface + Bytes func() []byte + Flush func() error + Reset func(w io.Writer) + func AcquirePerFlushWriter(parent ByteWriter, threshold int) ByteWriter + func AcquireWriter(w io.Writer) ByteWriter + type Bytecode struct + func CompileBytecode(nodes NodeStream) *Bytecode + func (bc *Bytecode) Exec(w ByteWriter, rc *RenderContext, data any) error + type Cache struct + func NewCache(capacity int) *Cache + func (c *Cache) Close() + func (c *Cache) Delete(engine, name string) + func (c *Cache) Get(engine, name string) (*Program, bool) + func (c *Cache) InvalidateTag(tag string) int + func (c *Cache) Put(engine, name string, p *Program) + func (c *Cache) SetTag(engine, name string, tags ...string) + func (c *Cache) Stats() CacheStats + type CacheStats struct + Capacity int + Evicts int64 + Hits int64 + Misses int64 + type Children []string + type Component interface + Render func(w ByteWriter, rc *RenderContext, data any) error + type ComponentContext struct + Children Children + Context *RenderContext + Data any + DataMap map[string]any + Slots Slots + State *State + Writer ByteWriter + func (c *ComponentContext) ActionURL(action string) string + func (c *ComponentContext) AddHXTrigger(name string) + func (c *ComponentContext) AddHXTriggerAfterSettle(name string) + func (c *ComponentContext) AddHXTriggerAfterSwap(name string) + func (c *ComponentContext) AddHXTriggerWithDetail(name string, detail any) + func (c *ComponentContext) AddMeta(name, content string) + func (c *ComponentContext) GetFormError(key string) string + func (c *ComponentContext) GetState(key string) (any, bool) + func (c *ComponentContext) ProvideContext(key string, val any) + func (c *ComponentContext) Render(name string, props any) error + func (c *ComponentContext) RequiresCSS(href string) + func (c *ComponentContext) RequiresJS(src string) + func (c *ComponentContext) SetFormError(key, msg string) + func (c *ComponentContext) SetState(key string, v any) + func (c *ComponentContext) SetTitle(title string) + func (c *ComponentContext) UseContext(key string) any + func (c *ComponentContext) UseId() string + func (c *ComponentContext) UseState(key string, initial any) (any, func(any)) + func (c *ComponentContext) Write(p []byte) (int, error) + func (c *ComponentContext) WriteChildren() + func (c *ComponentContext) WriteHydrateProps(attr string, props any) error + func (c *ComponentContext) WriteSlot(name string) + func (c *ComponentContext) WriteString(s string) (int, error) + func (c *ComponentContext) Yield() error + type ComponentFunc func(w ByteWriter, rc *RenderContext, data any) error + func (f ComponentFunc) Render(w ByteWriter, rc *RenderContext, data any) error + func (f ComponentFunc) WithFuncs(funcs template.FuncMap) Component + type ComponentMiddleware func(ComponentRenderFunc) ComponentRenderFunc + type ComponentRegistry struct + func NewComponentRegistry() *ComponentRegistry + func (r *ComponentRegistry) Define(name string) *Definition + func (r *ComponentRegistry) Lookup(name string) (Component, bool) + func (r *ComponentRegistry) Memoize(name string, keyer func(rc *RenderContext, data any) string) + func (r *ComponentRegistry) Names() []string + func (r *ComponentRegistry) Register(name string, c Component) + func (r *ComponentRegistry) Unregister(name string) + type ComponentRenderFunc func(c *ComponentContext) error + type ComponentWithChildren interface + RenderWithChildren func(w ByteWriter, rc *RenderContext, data any, children Children) error + type ComponentWithFuncs interface + ComponentFuncs func() template.FuncMap + type Composition struct + Engine string + Layout string + Parts []string + View string + type CompressConfig struct + Level int + MinSize int + Types []string + type DataInjector func(rc *RenderContext, data map[string]any) + type Definition struct + func (d *Definition) Action(name string, fn ActionFunc) *Definition + func (d *Definition) Async() *Definition + func (d *Definition) ErrorBoundary(fn ErrorBoundaryFunc) *Definition + func (d *Definition) Fallback(fn ComponentRenderFunc) *Definition + func (d *Definition) Metadata(fn func(rc *RenderContext, data any) error) *Definition + func (d *Definition) Register(cr *ComponentRegistry) + func (d *Definition) Render(fn ComponentRenderFunc) *Definition + func (d *Definition) RenderChildren(fn ComponentRenderFunc) *Definition + func (d *Definition) Use(mw ...ComponentMiddleware) *Definition + func (d *Definition) WithFuncs(funcs template.FuncMap) *Definition + func (d *Definition) WithOOB(targetID string) *Definition + type Dispatchable interface + Dispatch func(w ByteWriter, rc *RenderContext, data any, children Children) error + type Engine interface + Compile func(src []byte, name string) (*Program, error) + Execute func(p *Program, w ByteWriter, rc *RenderContext, data any) error + Name func() string + type EngineName string + const EngineHTML + const EngineHTMLTemplate + const EngineJade + const EngineTempl + func CustomEngine(name string) EngineName + func (n EngineName) String() string + type ErrorBoundaryFunc func(c *ComponentContext, err any) error + type Event struct + Op fsnotify.Op + Path string + type FuncMapBuilder func(rc *RenderContext) template.FuncMap + type HTMXResponse struct + Location string + PushURL string + Redirect string + Refresh string + ReplaceURL string + Reselect string + Resettle string + Reswap string + Retarget string + type HXTriggers map[string]any + func (t HXTriggers) Add(name string) + func (t HXTriggers) AddWithDetail(name string, detail any) + func (t HXTriggers) HasDetail() bool + func (t HXTriggers) Join() string + func (t HXTriggers) Names() []string + type MetadataProvider interface + Metadata func() func(rc *RenderContext, data any) error + type MinifyConfig struct + KeepConditionalComments bool + KeepDefaultAttrVals bool + KeepDocumentTags bool + KeepEndTags bool + KeepWhitespace bool + type NodeStream struct + AttrEnd []uint32 + AttrKeys []string + AttrStart []uint32 + AttrVals []any + ChildEnd []uint32 + ChildStart []uint32 + ComponentName []string + Count int + FirstChild []int32 + Flags []uint8 + NS []uint16 + NextSibling []int32 + Parent []int32 + Tag []string + TextOff []uint32 + func (s *NodeStream) AttrKey(i, k int) string + func (s *NodeStream) AttrVal(i, k int) any + func (s *NodeStream) ChildRange(i int) (uint32, uint32) + func (s *NodeStream) FirstChildOf(i int) int + func (s *NodeStream) IsComponent(i int) bool + func (s *NodeStream) IsText(i int) bool + func (s *NodeStream) IsVoid(i int) bool + func (s *NodeStream) NextSiblingOf(i int) int + func (s *NodeStream) NumAttr(i int) int + func (s *NodeStream) Reset() + func (s *NodeStream) Text(i int) []byte + type NodeStreamBuilder struct + func NewBuilder() *NodeStreamBuilder + func ParseHTML(src []byte, name string) (*NodeStreamBuilder, error) + func (b *NodeStreamBuilder) AppendComponent(name string, attrs []string, vals []any) int + func (b *NodeStreamBuilder) AppendNode(tag string, flags uint8) int + func (b *NodeStreamBuilder) AppendText(text []byte, raw bool) int + func (b *NodeStreamBuilder) Reserve(approxNodes int) *NodeStreamBuilder + func (b *NodeStreamBuilder) ReserveText(srcSize int) *NodeStreamBuilder + func (b *NodeStreamBuilder) Reset() + func (b *NodeStreamBuilder) SetAttrs(i int, keys []string, vals []any) + func (b *NodeStreamBuilder) SetAttrsEach(i int, attrs []AttrKV) + func (b *NodeStreamBuilder) SetChildren(i int, start, end uint32) + func (b *NodeStreamBuilder) SetParent(child, parent int) + func (b *NodeStreamBuilder) Stream() NodeStream + type OOBOptioner interface + OOBID func() string + type Option func(*Registry) + func WithActionPrefix(prefix string) Option + func WithCache(c *Cache) Option + func WithCacheSize(n int) Option + func WithCompression(level, minSize int) Option + func WithConditional() Option + func WithDebug() Option + func WithDefaultLoader(loader SourceFunc) Option + func WithEngine(e Engine) Option + func WithEngines(engines ...Engine) Option + func WithFuncMap(fn FuncMapBuilder) Option + func WithInjector(fn DataInjector) Option + func WithPipeline(p *Pipeline) Option + func WithVariant(name string, values ...string) Option + type PageComposer interface + RenderPage func(rc *RenderContext, w ByteWriter, layout, view string, data any) error + type ParseError struct + Msg string + Name string + Offset uint32 + func (e *ParseError) Error() string + func (e *ParseError) Unwrap() error + type Pipeline struct + AfterCompile func(p *Program) error + AfterExecute func(p *Program, rc *RenderContext, data any) error + BeforeCompile func(name string, src []byte) ([]byte, error) + BeforeExecute func(p *Program, rc *RenderContext, data any) error + func NewPipeline() *Pipeline + func (p *Pipeline) Debug(w io.Writer) *Pipeline + type PreloadHint struct + As string + Href string + Type string + type PreloadHints struct + type Program struct + Bytecode *Bytecode + ETag string + Engine string + EngineData any + FuncMap map[string]any + Layout *Program + Name string + Nodes NodeStream + Tags []string + type Registry struct + func New(opts ...Option) *Registry + func NewRegistry(engines ...Engine) *Registry + func (r *Registry) ActionPrefix() string + func (r *Registry) AddEngine(e Engine) *Registry + func (r *Registry) AttachComponents(c *ComponentRegistry) + func (r *Registry) Cache() *Cache + func (r *Registry) ComponentLookup(name string) (Component, bool) + func (r *Registry) Components() *ComponentRegistry + func (r *Registry) Compress(cfg CompressConfig) *Registry + func (r *Registry) CompressWriter(rc *RenderContext, w ByteWriter) (ByteWriter, func() error) + func (r *Registry) Conditional(enabled bool) *Registry + func (r *Registry) Default() Engine + func (r *Registry) DefaultLoader() SourceFunc + func (r *Registry) Define(name string) *Definition + func (r *Registry) Engine(name string) Engine + func (r *Registry) Engines() []Engine + func (r *Registry) FuncMap(b FuncMapBuilder) + func (r *Registry) HandleAction(w http.ResponseWriter, req *http.Request) + func (r *Registry) Inject(in DataInjector) + func (r *Registry) InjectFuncMap(rc *RenderContext, data any) + func (r *Registry) InvalidateTag(tag string) int + func (r *Registry) Minify() *MinifyConfig + func (r *Registry) MustPreloadParts(rc *RenderContext, engine string, parts ...string) + func (r *Registry) Page(rc *RenderContext) *RenderBuilder + func (r *Registry) Part(rc *RenderContext, engine, name string) (*Program, error) + func (r *Registry) Preload(h PreloadHint) + func (r *Registry) PreloadParts(rc *RenderContext, engine string, parts ...string) error + func (r *Registry) Preloads() []PreloadHint + func (r *Registry) Render(rc *RenderContext, engine, name string, data any) error + func (r *Registry) RenderComponent(w ByteWriter, rc *RenderContext, name string, props any) error + func (r *Registry) RenderComposition(rc *RenderContext, c Composition, data any) error + func (r *Registry) RenderNamed(rc *RenderContext, engine EngineName, name string, data any) error + func (r *Registry) RenderPage(rc *RenderContext, layout, view string, data any) error + func (r *Registry) RenderPageEngines(rc *RenderContext, layoutEngine EngineName, layout string, ...) error + func (r *Registry) RenderPageWith(rc *RenderContext, engine, layout, view string, data any) error + func (r *Registry) RenderStream(rc *RenderContext, engine EngineName, layout, view string, data any, ...) error + func (r *Registry) SetActionPrefix(prefix string) + func (r *Registry) SetCache(c *Cache) + func (r *Registry) SetDefaultLoader(loader SourceFunc) + func (r *Registry) SetPipeline(p *Pipeline) + func (r *Registry) SetTag(engine, name string, tags ...string) + func (r *Registry) SetVariant(dim, value string) + func (r *Registry) Unpreload(as, typeStr string) + func (r *Registry) Variant(name string, values ...string) + func (r *Registry) WithMinify(cfg MinifyConfig) *Registry + type RenderBuilder struct + func (rb *RenderBuilder) Engine(name EngineName) *RenderBuilder + func (rb *RenderBuilder) EngineInstance(e Engine) *RenderBuilder + func (rb *RenderBuilder) Layout(name string) *RenderBuilder + func (rb *RenderBuilder) Parts(parts ...string) *RenderBuilder + func (rb *RenderBuilder) Render() error + func (rb *RenderBuilder) RenderComposition() error + func (rb *RenderBuilder) View(name string) *RenderBuilder + func (rb *RenderBuilder) With(data any) *RenderBuilder + func (rb *RenderBuilder) WithDone(fn func()) *RenderBuilder + type RenderContext struct + ComponentFuncMap template.FuncMap + FuncMap template.FuncMap + Headers http.Header + Layout string + Loader SourceFunc + Request *http.Request + Times map[string]time.Duration + Variants map[string]string + ViewBytes []byte + Writer ByteWriter + func AcquireContext(w ByteWriter, req *http.Request) *RenderContext + func FromContext(ctx context.Context) *RenderContext + func (rc *RenderContext) AddHXTrigger(name string) + func (rc *RenderContext) AddHXTriggerAfterSettle(name string) + func (rc *RenderContext) AddHXTriggerAfterSwap(name string) + func (rc *RenderContext) AddHXTriggerWithDetail(name string, detail any) + func (rc *RenderContext) AddMeta(name, content string) + func (rc *RenderContext) ClearAssets() + func (rc *RenderContext) ClearFormErrors() + func (rc *RenderContext) ClearHeadState() + func (rc *RenderContext) CloseSuspense() + func (rc *RenderContext) ComponentRegistry() *ComponentRegistry + func (rc *RenderContext) ComponentState() *State + func (rc *RenderContext) ContextDepth() int + func (rc *RenderContext) EffectiveFuncMap(programDefaults template.FuncMap) template.FuncMap + func (rc *RenderContext) EnsureSuspense(w ByteWriter) *suspenseCoordinator + func (rc *RenderContext) FormErrors() map[string]string + func (rc *RenderContext) GetContext(key string) any + func (rc *RenderContext) GetFormError(key string) string + func (rc *RenderContext) HTMXResponse() HTMXResponse + func (rc *RenderContext) HXTriggers() HXTriggers + func (rc *RenderContext) HXTriggersAfterSettle() HXTriggers + func (rc *RenderContext) HXTriggersAfterSwap() HXTriggers + func (rc *RenderContext) OOBSink() ByteWriter + func (rc *RenderContext) PopContextTo(savedPtr int) + func (rc *RenderContext) PushContext(key string, val any) + func (rc *RenderContext) RequiresCSS(href string) + func (rc *RenderContext) RequiresJS(src string) + func (rc *RenderContext) SetComponentRegistry(c *ComponentRegistry) + func (rc *RenderContext) SetFormError(key, msg string) + func (rc *RenderContext) SetHXLocation(url string) + func (rc *RenderContext) SetHXPushURL(url string) + func (rc *RenderContext) SetHXRedirect(url string) + func (rc *RenderContext) SetHXRefresh() + func (rc *RenderContext) SetHXReplaceURL(url string) + func (rc *RenderContext) SetHXReselect(selector string) + func (rc *RenderContext) SetHXResettle(value string) + func (rc *RenderContext) SetHXReswap(strategy string) + func (rc *RenderContext) SetHXRetarget(selector string) + func (rc *RenderContext) SetOOBSink(w ByteWriter) + func (rc *RenderContext) SetTitle(title string) + func (rc *RenderContext) SetUserData(d any) + func (rc *RenderContext) SetVariant(dim, value string) + func (rc *RenderContext) SubmitAsync(id string, fn func(w ByteWriter, rc *RenderContext, data any) error, ...) + func (rc *RenderContext) Suspense() *suspenseCoordinator + func (rc *RenderContext) Title() string + func (rc *RenderContext) UseId() string + func (rc *RenderContext) UserData() any + func (rc *RenderContext) WithDebug() *RenderContext + func (rc *RenderContext) WithFuncMap(fm template.FuncMap) *RenderContext + func (rc *RenderContext) WithLayout(name string) *RenderContext + func (rc *RenderContext) WithLoader(loader SourceFunc) *RenderContext + func (rc *RenderContext) WriteHTMXHeaders(w http.ResponseWriter) + func (rc *RenderContext) WriteHeader(key, value string) + func (rc *RenderContext) WriteHeadersTo(w io.Writer) error + type Slots map[string]string + type SourceFunc func(name string) ([]byte, error) + func NewFileLoader(root, ext string) SourceFunc + func NewMapLoader(templates map[string][]byte) SourceFunc + func NewPrefixLoader(prefix string, fs interface{ ... }) SourceFunc + type Sourceless interface + NoSource func() + type State struct + func NewState() *State + func (s *State) Clear() + func (s *State) Get(key string) (any, bool) + func (s *State) Set(key string, value any) + func (s *State) UseState(key string, initialValue any) any + type Watcher struct + func NewWatcher(roots ...string) (*Watcher, error) + func (w *Watcher) Close() error + func (w *Watcher) Disabled() bool + func (w *Watcher) Events() <-chan Event