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 ¶
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.
Click to show internal directories.
Click to hide internal directories.