input

package
v0.3.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2026 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TagOpen = []byte("<input")

	AttrName                = []byte(" name=\"")
	AttrValue               = []byte(" value=\"")
	AttrType                = []byte(" type=\"")
	AttrSrc                 = []byte(" src=\"")
	AttrAccept              = []byte(" accept=\"")
	AttrAlt                 = []byte(" alt=\"")
	AttrAutoComplete        = []byte(" autocomplete=\"")
	AttrCapture             = []byte(" capture=\"")
	AttrChecked             = []byte(" checked")
	AttrDirName             = []byte(" dirname=\"")
	AttrDisabled            = []byte(" disabled")
	AttrForm                = []byte(" form=\"")
	AttrFormAction          = []byte(" formaction=\"")
	AttrFormEncType         = []byte(" formenctype=\"")
	AttrFormMethod          = []byte(" formmethod=\"")
	AttrFormNoValidate      = []byte(" formnovalidate")
	AttrFormTarget          = []byte(" formtarget=\"")
	AttrHeight              = []byte(" height=\"")
	AttrList                = []byte(" list=\"")
	AttrMax                 = []byte(" max=\"")
	AttrMaxLength           = []byte(" maxlength=\"")
	AttrMin                 = []byte(" min=\"")
	AttrMinLength           = []byte(" minlength=\"")
	AttrMultiple            = []byte(" multiple")
	AttrPattern             = []byte(" pattern=\"")
	AttrPlaceholder         = []byte(" placeholder=\"")
	AttrPopoverTarget       = []byte(" popovertarget=\"")
	AttrPopoverTargetAction = []byte(" popovertargetaction=\"")
	AttrReadOnly            = []byte(" readonly")
	AttrRequired            = []byte(" required")
	AttrSize                = []byte(" size=\"")
	AttrStep                = []byte(" step=\"")
	AttrWidth               = []byte(" width=\"")
	AttrAlpha               = []byte(" alpha")
	AttrColorSpace          = []byte(" colorspace=\"")
)

Byte constants for HTML rendering.

Functions

func Button

func Button(value string) *element

Button Creates a button input with no default behaviour. Example: input.Button("Click Me") Renders: <input value="Click Me" type="button" />

func Checkbox

func Checkbox(name string, value string) *element

Checkbox Creates a checkbox input for boolean or multi-select options. Example: input.Checkbox("agree", "yes") Renders: <input name="agree" value="yes" type="checkbox" />

func Color

func Color(name string) *element

Color Creates a colour picker input field. Example: input.Color("theme") Renders: <input name="theme" type="color" />

func Date

func Date(name string) *element

Date Creates a date picker input field. Example: input.Date("birthday") Renders: <input name="birthday" type="date" />

func DateTimeLocal

func DateTimeLocal(name string) *element

DateTimeLocal Creates a local date and time picker input field. Example: input.DateTimeLocal("meeting") Renders: <input name="meeting" type="datetime-local" />

func Email

func Email(name string) *element

Email Creates an email input field with automatic email validation. Example: input.Email("email") Renders: <input name="email" type="email" />

func File

func File(name string) *element

File Creates a file upload input for selecting local files. Example: input.File("avatar") Renders: <input name="avatar" type="file" />

func Hidden

func Hidden(name string, value string) *element

Hidden Creates a hidden input field not visible to users. Example: input.Hidden("csrf_token", "abc123") Renders: <input name="csrf_token" value="abc123" type="hidden" />

func Image

func Image(name string, src string) *element

Image Creates an image submit button with graphical representation. Example: input.Image("submit", "/images/submit.png") Renders: <input name="submit" type="image" src="/images/submit.png" />

func Month

func Month(name string) *element

Month Creates a month picker input field. Example: input.Month("expiry") Renders: <input name="expiry" type="month" />

func New

func New() *element

New Creates a new input element without any initial attributes. Example: input.New().Type(inputtype.Text).Name("username") Renders: <input name="username" type="text" />

func Number

func Number(name string) *element

Number Creates a numeric input field with spinner controls. Example: input.Number("quantity") Renders: <input name="quantity" type="number" />

func Password

func Password(name string) *element

Password Creates a password input field that obscures entered characters. Example: input.Password("password") Renders: <input name="password" type="password" />

func Radio

func Radio(name string, value string) *element

Radio Creates a radio button input for exclusive selection within a group. Example: input.Radio("gender", "male") Renders: <input name="gender" value="male" type="radio" />

func Range

func Range(name string) *element

Range Creates a range slider input for selecting numeric values. Example: input.Range("volume") Renders: <input name="volume" type="range" />

func Reset

func Reset(value string) *element

Reset Creates a reset button input that clears form values. Example: input.Reset("Clear Form") Renders: <input value="Clear Form" type="reset" />

func Search(name string) *element

Search Creates a search input field optimised for search queries. Example: input.Search("query") Renders: <input name="query" type="search" />

func Submit

func Submit(value string) *element

Submit Creates a submit button input for form submission. Example: input.Submit("Submit Form") Renders: <input value="Submit Form" type="submit" />

func Tel

func Tel(name string) *element

Tel Creates a telephone number input field. Example: input.Tel("phone") Renders: <input name="phone" type="tel" />

func Text

func Text(name string, value string) *element

Text Creates a text input field for single-line text entry. Example: input.Text("title", "Mr") Renders: <input name="title" value="Mr" type="text" />

func Time

func Time(name string) *element

Time Creates a time picker input field. Example: input.Time("appointment") Renders: <input name="appointment" type="time" />

func URL

func URL(name string) *element

URL Creates a URL input field with URL validation. Example: input.URL("website") Renders: <input name="website" type="url" />

func Week

func Week(name string) *element

Week Creates a week picker input field. Example: input.Week("schedule") Renders: <input name="schedule" type="week" />

Types

type Element

type Element = element

Element is an exported alias for the private element type

Jump to

Keyboard shortcuts

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