Textbox
Textbox create a textbox and return its value.
API
Interface
func Textbox(c *tgframe.Container, label string, conf ...*TextboxConf) string
Parameters
cis Parent container.labelis the label for textbox.confis an optional configuration, at most one.
// TextboxConf is the configuration for the Textbox component
type TextboxConf struct {
tgframe.Base // ID
// Placeholder text to display in the textbox.
Placeholder string
// Maximum number of characters allowed in the textbox.
// If 0, there is no character limit.
MaxLength int
// Indicates whether the textbox should mask input as asterisks.
Password bool
// Indicates whether the textbox should be disabled.
Disabled bool
// Default value of the textbox.
Default string
// ResetKey drops the app user's input and restores Default whenever it
// changes, e.g. a hash of the file the text was filled from.
ResetKey string
// Color defines the color of the textbox
Color tcutil.Color
}
Example
textboxValue := tgcomp.Textbox(p.Main, "Textbox", &tgcomp.TextboxConf{
Placeholder: "input the value here",
Color: tcutil.ColorInfo,
})
tgcomp.Text(p.Main, "Value: "+textboxValue,
&tgcomp.TextConf{ID: "textbox_result"})
