Skip to content

Commit

Permalink
feat: add new form component
Browse files Browse the repository at this point in the history
  • Loading branch information
katallaxie authored Nov 15, 2024
1 parent 82ff69e commit b9a9417
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions components/forms/form.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package forms

import htmx "github.com/zeiss/fiber-htmx"

// FormProps represents the properties for a form element.
type FormProps struct {
ClassNames htmx.ClassNames // The class names for the form element.
}

// Form returns a form element based on the provided properties.
func Form(p FormProps, children ...htmx.Node) htmx.Node {
return htmx.Form(
htmx.Merge(
htmx.ClassNames{
"form": true,
"group": true,
},
p.ClassNames,
),
htmx.Group(children...),
)
}

0 comments on commit b9a9417

Please sign in to comment.