2026-05-14 16:46:42 +00:00
|
|
|
package ui
|
|
|
|
|
|
|
|
|
|
// ButtonProps is the input to the Button templ component.
|
|
|
|
|
//
|
|
|
|
|
// Type defaults to "button" when empty. Attrs is a pass-through for arbitrary
|
2026-05-16 11:52:01 +00:00
|
|
|
// attributes (notably hx-* HTMX attributes). Icon is a named icon key that
|
|
|
|
|
// will be rendered via UIIcon when Plan 04 wires up icon_button.templ.
|
2026-05-14 16:46:42 +00:00
|
|
|
type ButtonProps struct {
|
|
|
|
|
Label string
|
|
|
|
|
Variant ButtonVariant
|
|
|
|
|
Tone ButtonTone
|
|
|
|
|
Size Size
|
|
|
|
|
Type string
|
2026-05-16 11:52:01 +00:00
|
|
|
Icon string
|
2026-05-14 16:46:42 +00:00
|
|
|
Attrs templ.Attributes
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
templ Button(props ButtonProps) {
|
2026-05-16 11:52:01 +00:00
|
|
|
<button type={ buttonType(props.Type) } class={ ButtonClass(props.Variant, props.Tone, props.Size) } { props.Attrs... }>
|
2026-05-16 12:07:07 +00:00
|
|
|
if props.Icon != "" {
|
|
|
|
|
<span class="ui-button-icon">@UIIcon(props.Icon)</span>
|
|
|
|
|
}
|
2026-05-16 11:52:01 +00:00
|
|
|
{ props.Label }
|
|
|
|
|
</button>
|
2026-05-14 16:46:42 +00:00
|
|
|
}
|