6.1 Links, buttons, and inputs
Button / SubmitButton
Button(label string, props ComponentProps) NodeButtonWithVariants(label, variant, size, style string, props ComponentProps) NodeSubmitButton(label string, props ComponentProps) Node- Extend with
props.Class,props.ID, andprops.Attrs.
Link family
Link(props LinkProps) NodeExternalLink(label, href string, props ComponentProps) NodeExternalIconLink(icon, ariaLabel, href string, props ComponentProps) NodeDownloadLink(label, href, filename string, props ComponentProps) Node
Link behaviors:
External: truedefaults totarget="_blank"+rel="noopener noreferrer".Target: "_blank"also defaultsrel="noopener noreferrer".Download: trueemitsdownload.Filenameemitsdownload="<filename>".Props.Disabled: truerenders inerthref="#"+aria-disabled.
Input / Textarea / Select
Input(name, value string, props ComponentProps) Node- Defaults:
Type: "text",Placeholder: strings.TrimSpace(name).
- Defaults:
FileUpload(name string, required bool, props ...ComponentProps) Node- Emits
type="file".
- Emits
InputWithOptions(name, value string, options InputOptions) Node- Blank
options.Typedefaults to"text". - Common values:
text,email,password,number,search,url,tel,date,datetime-local,time,month,week,file,hidden.
- Blank
Textarea(name, value string, options TextareaOptions) NodeRows <= 0defaults to3.
Select(name string, options []SelectOption, props ComponentProps) NodeSelectWithVariants(name string, options []SelectOption, props SelectVariantProps) Node- Uses
SelectOption.Value,Label,Selected,Disabled.
- Uses
Form family
Form(action string, children ...Node) *formActionForm(props ActionFormProps, children ...Node) NodeMethod:post(default),getTarget->hx-target,Swap->hx-swap
HiddenField(name, value string) NodeFormField(control Node, props FormFieldProps) Node