- icon-button.css + icon_button.templ: UIIcon switch (plus/grid3x3/list/filter/search/calendar/pencil/trash + fallback span) - spacing.css + space.templ: SpaceX/SpaceY with SpacingStep classes - button.templ: wire @UIIcon(props.Icon) replacing Plan 02 placeholder comment - tailwind.input.css: add modal, empty-state, table, icon-button, form-field, spacing imports (14 total) - All 7 new tests pass; full go test ./... green
25 lines
735 B
Text
25 lines
735 B
Text
package ui
|
|
|
|
// ButtonProps is the input to the Button templ component.
|
|
//
|
|
// Type defaults to "button" when empty. Attrs is a pass-through for arbitrary
|
|
// 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.
|
|
type ButtonProps struct {
|
|
Label string
|
|
Variant ButtonVariant
|
|
Tone ButtonTone
|
|
Size Size
|
|
Type string
|
|
Icon string
|
|
Attrs templ.Attributes
|
|
}
|
|
|
|
templ Button(props ButtonProps) {
|
|
<button type={ buttonType(props.Type) } class={ ButtonClass(props.Variant, props.Tone, props.Size) } { props.Attrs... }>
|
|
if props.Icon != "" {
|
|
<span class="ui-button-icon">@UIIcon(props.Icon)</span>
|
|
}
|
|
{ props.Label }
|
|
</button>
|
|
}
|