Documentation
¶
Overview ¶
Package form provides a reusable, typed form model for create/edit flows.
A Form is composed of typed fields (text, select/enum, bool toggle, numeric) with vertical focus traversal, per-field validation and Submit/Cancel actions. It renders as a plain string for a hosting page's content area (not a modal), and emits FormSubmitMsg / FormCancelMsg on the respective actions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Field ¶
type Field struct {
Name string // key used in the submitted Values map
Label string // human-readable label
Type FieldType // field kind
Required bool // whether an empty value is rejected
Options []string // choices for Select fields
Validator Validator // optional custom validation
Default string // initial value (text/numeric) or default option
}
Field describes a single form field.
type Form ¶
type Form struct {
core.BaseComponent
// contains filtered or unexported fields
}
Form is a reusable form component.
func (*Form) SetDimensions ¶
SetDimensions sets the component dimensions and adjusts input widths.
func (*Form) Validate ¶
Validate runs validation on every field, recording inline errors, and reports whether the whole form is valid.
type FormCancelMsg ¶
type FormCancelMsg struct{}
FormCancelMsg is emitted when the form is cancelled.
type FormSubmitMsg ¶
FormSubmitMsg is emitted when the form is submitted with all fields valid.