Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion button.templ
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ templ ButtonGroup(opts ...props.ButtonGroup) {
// If the Anchor property is set, it renders an <a> tag, otherwise a <button> tag.
// Supports sizes: "sm", "md" (default), "lg", and "icon"
// Supports variants: "primary", "secondary", "danger" and "transparent"
//
// Note: the type attribute is set via two independent conditions rather than
// `if/else if`. templ v0.3.1001 mis-generates `else if` in attribute position,
// emitting a literal `else` into the markup.
templ Button(p ...props.Button) {
{{ btn := props.First(p) }}
if btn.IsAnchor() {
Expand Down Expand Up @@ -82,7 +86,8 @@ templ Button(p ...props.Button) {
}
if btn.Type != "" {
type={ btn.Type }
} else if btn.Copy != "" {
}
if btn.Type == "" && btn.Copy != "" {
type="button"
}
if btn.Name != "" {
Expand Down
88 changes: 44 additions & 44 deletions button_templ.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading