| Key | Action |
|---|
Enter | Click button |
Space | Click button |
When SetDisabled(true), all input is silently ignored.
Usage
btn := components.NewButton("Save").
SetVariant(components.ButtonPrimary).
Methods
| Method | Signature | Description |
Click | func (b *Button) Click() | Click programmatically triggers the button click. |
GetFieldHeight | func (b *Button) GetFieldHeight() int | GetFieldHeight returns the preferred height for this button. |
OnClick | func (b *Button) OnClick(handler func()) *Button | OnClick is an alias for SetOnClick for a more fluent API. |
Primitive | func (b *Button) Primitive() *tview.Box | Primitive returns the underlying tview.Box for advanced usage. |
SetDisabled | func (b *Button) SetDisabled(disabled bool) *Button | SetDisabled sets whether the button is disabled. |
SetLabel | func (b *Button) SetLabel(label string) *Button | SetLabel sets the button label. |
SetOnClick | func (b *Button) SetOnClick(handler func()) *Button | SetOnClick sets the click handler. |
SetVariant | func (b *Button) SetVariant(variant ButtonVariant) *Button | SetVariant sets the button visual variant. |
Types
| Constant | Description |
ButtonDefault | |
ButtonPrimary | |
ButtonSecondary | |
ButtonDanger | |
ButtonGhost | |