field

package
v0.0.0-...-c353a36 Latest Latest
Warning

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

Go to latest
Published: May 19, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package field binds labels, hints, native controls, Switch role on checkbox primitive.

templ: version: v0.3.1001

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Field

func Field(props FieldProps) templ.Component
Example (PlainInput)
package main

import (
	"bytes"
	"context"
	"fmt"

	"github.com/fastygo/base/field"
)

func main() {
	var buf bytes.Buffer
	cmp := field.Field(field.FieldProps{Name: "email", Class: "control"})
	if err := cmp.Render(context.Background(), &buf); err != nil {
		panic(err)
	}
	fmt.Print(buf.String())
}
Output:
<input id="email" name="email" type="text" class="control" placeholder="" value="" min="" max="" autocomplete="">

func FieldControl

func FieldControl(props FieldProps) templ.Component

Types

type FieldOption

type FieldOption struct {
	Value string
	Label string
}

FieldOption is a select pairing.

type FieldProps

type FieldProps struct {
	ID           string
	Role         string
	TabIndex     string
	Attrs        templ.Attributes
	Class        string
	Type         string
	Name         string
	Placeholder  string
	Value        string
	Rows         int
	Min          string
	Max          string
	Checked      bool
	Disabled     bool
	Required     bool
	Autocomplete string
	Component    string
	Options      []FieldOption
	Label        string
	Hint         string
	Error        string
	AriaLabel    string
	Switch       bool
	WrapperClass string
	LabelClass   string
	HintClass    string
	ErrorClass   string
}

FieldProps drives native controls; Caller supplies WrapperClass/LabelClass/HintClass/ErrorClass presets.

Jump to

Keyboard shortcuts

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