Documentation
¶
Index ¶
- func ValidateButton(b *Button) error
- type Button
- func (b *Button) Clicked(gtx layout.Context) bool
- func (b *Button) Layout(gtx layout.Context, th *theme.Theme) layout.Dimensions
- func (b *Button) SafeLayout(gtx layout.Context, th *theme.Theme) (layout.Dimensions, error)
- func (b *Button) SetDisabled(disabled bool)
- func (b *Button) SetOnClick(onClick func())
- func (b *Button) SetText(text string)
- func (b *Button) SetVariant(variant theme.Variant)
- func (b *Button) Update(gtx layout.Context) theme.ComponentState
- type ButtonOption
- func WithClasses(classes string) ButtonOption
- func WithDisabled(disabled bool) ButtonOption
- func WithIcon(icon *widget.Icon) ButtonOption
- func WithOnClick(onClick func()) ButtonOption
- func WithSize(size theme.Size) ButtonOption
- func WithText(text string) ButtonOption
- func WithVariant(variant theme.Variant) ButtonOption
- type ButtonState
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateButton ¶
ValidateButton validates that a button has all required fields
Types ¶
type Button ¶
type Button struct {
// Configuration
Text string
Variant theme.Variant
Size theme.Size
Icon *widget.Icon
Disabled bool
Classes string
OnClick func()
// contains filtered or unexported fields
}
Button represents a shadcn/ui button component
func NewButton ¶
func NewButton(options ...ButtonOption) *Button
NewButton creates a new Button with the given options
func (*Button) SafeLayout ¶
SafeLayout is a wrapper around Layout that validates the button first
func (*Button) SetDisabled ¶
SetDisabled sets the disabled state of the button
func (*Button) SetOnClick ¶
func (b *Button) SetOnClick(onClick func())
SetOnClick sets the click handler
func (*Button) SetVariant ¶
SetVariant sets the button variant
type ButtonOption ¶
type ButtonOption func(*Button)
ButtonOption is a functional option for configuring Button components
func WithClasses ¶
func WithClasses(classes string) ButtonOption
WithClasses sets additional CSS-like classes
func WithDisabled ¶
func WithDisabled(disabled bool) ButtonOption
WithDisabled sets the disabled state
func WithVariant ¶
func WithVariant(variant theme.Variant) ButtonOption
WithVariant sets the button variant
type ButtonState ¶
type ButtonState struct {
// contains filtered or unexported fields
}
func (*ButtonState) IsActive ¶
func (bs *ButtonState) IsActive() bool
func (*ButtonState) IsDisabled ¶
func (bs *ButtonState) IsDisabled() bool
func (*ButtonState) IsHovered ¶
func (bs *ButtonState) IsHovered() bool
func (*ButtonState) IsPressed ¶
func (bs *ButtonState) IsPressed() bool
Click to show internal directories.
Click to hide internal directories.