Bus UI Actions
Button renders the common action shape.
Use Button for the common labelled action. The public package returns a typed node and keeps HTML rendering explicit.
Public API
| Function | ui.Button |
|---|---|
| Props | ui.ButtonProps |
| Render boundary | Render the returned node with gx.RenderHTML when HTML is needed. |
| Use for | Primary, secondary, danger, and compact labelled actions. |
Example
Loading Button demo...
Go API
Use the helper when a module needs a typed node and explicit HTML rendering at the boundary.
import (
gx "github.com/busdk/bus-gx/pkg/gx"
ui "github.com/busdk/bus-ui/pkg/ui"
)
node, err := ui.Button(ui.ButtonProps{
Label: "Save draft",
Variant: ui.ButtonPrimary,
})
if err != nil {
return err
}
html, err := gx.RenderHTML(node)
.gx source
In .gx source, write the button as markup or wrap that markup in a local component with lower-camel props.
package actionsui
import gx "github.com/busdk/bus-gx/pkg/gx"
type PrimaryButtonProps struct {
Label string
}
func PrimaryButton(props PrimaryButtonProps) gx.Node {
return <button class="button button-primary" type="button">
<Text value={props.Label}></Text>
</button>
}
var toolbarButton = <PrimaryButton label={"Save draft"}></PrimaryButton>