6.1 リンク・ボタン・入力
Button / SubmitButton
Button(label string, props ComponentProps) NodeSubmitButton(label string, props ComponentProps) Nodeprops.Class,props.ID,props.Attrsで拡張できます。
Link 系
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 の主要挙動:
External: trueでtarget="_blank"+rel="noopener noreferrer"を補完。Target: "_blank"指定時もrel="noopener noreferrer"を補完。Download: trueでdownload属性を出力。Filename指定時はdownload="<filename>"。Props.Disabled: trueではhref="#"+aria-disabledの無効表示。
Input / Textarea / Select
Input(name, value string, props ComponentProps) Node- デフォルト:
Type: "text",Placeholder: strings.TrimSpace(name)
- デフォルト:
FileUpload(name string, required bool, props ...ComponentProps) Nodetype="file"を出力。
InputWithOptions(name, value string, options InputOptions) Nodeoptions.Type空文字は"text"。- 代表値:
text,email,password,number,search,url,tel,date,datetime-local,time,month,week,file,hidden。
Textarea(name, value string, options TextareaOptions) NodeRows <= 0は3。
Select(name string, options []SelectOption, props ComponentProps) NodeSelectWithVariants(name string, options []SelectOption, color, size, style string, props ComponentProps) NodeSelectOptionのValue,Label,Selected,Disabledを反映。
Form 系
Form(action string, children ...Node) *formActionForm(props ActionFormProps, children ...Node) NodeMethod:post(デフォルト),getTarget→hx-target,Swap→hx-swap
HiddenField(name, value string) NodeFormField(control Node, props FormFieldProps) Node