Documentation
¶
Index ¶
- type Base
- func (b *Base) AddAttribute(key, value string)
- func (b *Base) Children() []dom.Component
- func (b *Base) FieldName() string
- func (b *Base) GetID() string
- func (b *Base) GetOptions() []fmt.KeyValue
- func (b *Base) GetPlaceholder() string
- func (b *Base) GetSelectedValue() string
- func (b *Base) GetSkipValidation() bool
- func (b *Base) GetTitle() string
- func (b *Base) GetValue() string
- func (b *Base) GetValues() []string
- func (b *Base) HTMLName() string
- func (b *Base) HandlerName() string
- func (b *Base) InitBase(parentID, name, htmlName string)
- func (b *Base) RenderHTML() string
- func (b *Base) RenderInput() string
- func (b *Base) SetID(id string)
- func (b *Base) SetOptions(opts ...fmt.KeyValue)
- func (b *Base) SetPlaceholder(ph string)
- func (b *Base) SetRequired(req bool)
- func (b *Base) SetSkipValidation(skip bool)
- func (b *Base) SetTitle(title string)
- func (b *Base) SetValues(v ...string)
- func (b *Base) Type() string
- func (b *Base) Validate(value string) error
- type Input
- func Address() Input
- func Checkbox() Input
- func Datalist() Input
- func Date() Input
- func Email() Input
- func Filepath() Input
- func Gender() Input
- func Hour() Input
- func IP() Input
- func Number() Input
- func Password() Input
- func Phone() Input
- func Radio() Input
- func Rut() Input
- func Select() Input
- func Text() Input
- func Textarea() Input
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Base ¶
type Base struct {
Values []string // Multiple values support (for select/checkbox/etc)
Options []fmt.KeyValue // Multiple options for select/checkbox/etc
Placeholder string
Title string
Required bool // HTML required attribute
Disabled bool // HTML disabled attribute
Readonly bool // HTML readonly attribute
SkipValidation bool // Whether to skip validation for this input
Attributes []fmt.KeyValue
fmt.Permitted // anonymous embed: promotes Letters, Numbers, Validate(), etc.
// contains filtered or unexported fields
}
Base contains common logic and fields (State) for all inputs. It is intended to be embedded in concrete input structs.
func (*Base) AddAttribute ¶
AddAttribute adds a custom attribute to the input.
func (*Base) GetOptions ¶
GetOptions returns all options.
func (*Base) GetPlaceholder ¶
GetPlaceholder returns the input placeholder.
func (*Base) GetSelectedValue ¶
GetSelectedValue returns the first value in Values, or empty if none.
func (*Base) GetSkipValidation ¶
GetSkipValidation returns whether to skip validation.
func (*Base) HandlerName ¶ added in v0.0.4
HandlerName returns the component's unique identifier. Deprecated: use GetID instead.
func (*Base) RenderHTML ¶ added in v0.0.12
RenderHTML renders the input to HTML.
func (*Base) RenderInput ¶
RenderInput generates the HTML for the input based on its htmlName. Handles: input, textarea, select (with options), radio (label+input per option), and datalist (input + datalist element). No custom RenderHTML needed in sub-types.
func (*Base) SetOptions ¶
SetOptions sets multiple options (for select/checkbox/etc).
func (*Base) SetPlaceholder ¶
SetPlaceholder sets the input placeholder.
func (*Base) SetRequired ¶ added in v0.2.0
SetRequired sets the required attribute.
func (*Base) SetSkipValidation ¶
SetSkipValidation sets whether to skip validation for this input.
type Input ¶
type Input interface {
fmt.Widget // Type(), Validate(), Clone(parentID, name) — semantic type contract
dom.Component // Includes GetID(), SetID(), RenderHTML(), Children()
FieldName() string
SetRequired(bool)
AddAttribute(key, value string)
}
Input interface defines the behavior for all form input types. It embeds dom.Component to ensure compatibility with the tinywasm/dom ecosystem.
func Checkbox ¶ added in v0.0.19
func Checkbox() Input
Checkbox creates a new checkbox input instance.
func Datalist ¶ added in v0.0.19
func Datalist() Input
Datalist creates a new datalist input instance.
func Filepath ¶ added in v0.0.19
func Filepath() Input
Filepath creates a new filepath input instance.