feat: update attr documentation
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Simon Vieille 2025-07-27 12:54:40 +02:00
commit d89541a762
Signed by: deblan
GPG key ID: 579388D585F70417
2 changed files with 10 additions and 9 deletions

View file

@ -268,14 +268,15 @@ func (f *Field) WithOptions(options ...*Option) *Field
#### Common options
| Name | type | description | Info |
| ---- | ---- | ---- | ---- |
| `required` | `bool` | Add `required="true"` | Does not apply a constraint |
| `attr` | `map[string]string` | List of extra attributes of the field | |
| `row_attr` | `map[string]string` | List of extra attributes of the field's top container | |
| `label` | `string` | The label of the field | Usually show before the field |
| `label_attr` | `map[string]string` | List of extra attributes of the label | |
| `help` | `string` | Helper of the field | |
| Name | type | description | Info |
| ---- | ---- | ---- | ---- |
| `required` | `bool` | Add `required="true"` | Does not apply a constraint |
| `attr` | `form.Attrs` | List of extra attributes of the field | |
| `row_attr` | `form.Attrs` | List of extra attributes of the field's top container | |
| `label` | `string` | The label of the field | Usually show before the field |
| `label_attr` | `form.Attrs` | List of extra attributes of the label | |
| `help` | `string` | Helper of the field | |
| `help_attr` | `form.Attrs` | List of extra attributes of the help | |
Appends options to the field

View file

@ -54,7 +54,7 @@ Some options are natively supported in go-form themes.
myForm.WithOptions(
form.NewOption("help", "A help for the form"),
// <form data-foo="bar" data-bar="bar" ...
form.NewOption("attr", map[string]string{
form.NewOption("attr", form.Attrs{
"data-foo": "foo",
"data-bar": "bar",
}),