Getting Started
Exploring Fyne
Drawing and Animation
Containers and Layout
Widgets
Label (/widget/label)
Button (/widget/button)
Entry (/widget/entry)
Choices (/widget/choices)
Form (/widget/form)
ProgressBar (/widget/progressbar)
Toolbar (/widget/toolbar)
Collections
Data Binding
Extending Fyne
Architecture
Frequently Asked Questions
API Documentation
Upgrade to v2.5 (/api/v2.5/[Link])
Fyne API v2.5 (/api/v2.5/)
app (/api/v2.5/app/)
canvas (/api/v2.5/canvas/)
container (/api/v2.5/container/)
data/binding (/api/v2.5/data/binding/)
data/validation (/api/v2.5/data/validation/)
dialog (/api/v2.5/dialog/)
driver (/api/v2.5/driver/)
driver/desktop (/api/v2.5/driver/desktop/)
driver/mobile (/api/v2.5/driver/mobile/)
driver/software (/api/v2.5/driver/software/)
lang (/api/v2.5/lang/)
layout (/api/v2.5/layout/)
storage (/api/v2.5/storage/)
storage/repository (/api/v2.5/storage/repository/)
test (/api/v2.5/test/)
theme (/api/v2.5/theme/)
widget (/api/v2.5/widget/)
package widget (/api/v2.5/widget/)
Accordion (/api/v2.5/widget/[Link])
AccordionItem (/api/v2.5/widget/[Link])
Activity (/api/v2.5/widget/[Link])
BaseWidget (/api/v2.5/widget/[Link])
Button (/api/v2.5/widget/[Link])
ButtonAlign (/api/v2.5/widget/[Link])
ButtonIconPlacement (/api/v2.5/widget/[Link])
ButtonImportance (/api/v2.5/widget/[Link])
ButtonStyle (/api/v2.5/widget/[Link])
Card (/api/v2.5/widget/[Link])
Check (/api/v2.5/widget/[Link])
CheckGroup (/api/v2.5/widget/[Link])
CustomTextGridStyle (/api/v2.5/widget/[Link])
DisableableWidget (/api/v2.5/widget/[Link])
Entry (/api/v2.5/widget/[Link])
FileIcon (/api/v2.5/widget/[Link])
Form (/api/v2.5/widget/[Link])
FormItem (/api/v2.5/widget/[Link])
GridWrap (/api/v2.5/widget/[Link])
GridWrapItemID (/api/v2.5/widget/[Link])
Hyperlink (/api/v2.5/widget/[Link])
HyperlinkSegment (/api/v2.5/widget/[Link])
Icon (/api/v2.5/widget/[Link])
ImageSegment (/api/v2.5/widget/[Link])
Importance (/api/v2.5/widget/[Link])
Label (/api/v2.5/widget/[Link])
List (/api/v2.5/widget/[Link])
ListItemID (/api/v2.5/widget/[Link])
ListSegment (/api/v2.5/widget/[Link])
Menu (/api/v2.5/widget/[Link])
Orientation (/api/v2.5/widget/[Link])
ParagraphSegment (/api/v2.5/widget/[Link])
PopUp (/api/v2.5/widget/[Link])
PopUpMenu (/api/v2.5/widget/[Link])
ProgressBar (/api/v2.5/widget/[Link])
ProgressBarInfinite (/api/v2.5/widget/[Link])
RadioGroup (/api/v2.5/widget/[Link])
RichText (/api/v2.5/widget/[Link])
RichTextBlock (/api/v2.5/widget/[Link])
RichTextSegment (/api/v2.5/widget/[Link])
RichTextStyle (/api/v2.5/widget/[Link])
Select (/api/v2.5/widget/[Link])
SelectEntry (/api/v2.5/widget/[Link])
Separator (/api/v2.5/widget/[Link])
SeparatorSegment (/api/v2.5/widget/[Link])
Slider (/api/v2.5/widget/[Link])
Table (/api/v2.5/widget/[Link])
TableCellID (/api/v2.5/widget/[Link])
TextGrid (/api/v2.5/widget/[Link])
TextGridCell (/api/v2.5/widget/[Link])
TextGridRow (/api/v2.5/widget/[Link])
TextGridStyle (/api/v2.5/widget/[Link])
TextSegment (/api/v2.5/widget/[Link])
Toolbar (/api/v2.5/widget/[Link])
ToolbarAction (/api/v2.5/widget/[Link])
ToolbarItem (/api/v2.5/widget/[Link])
ToolbarSeparator (/api/v2.5/widget/[Link])
ToolbarSpacer (/api/v2.5/widget/[Link])
Tree (/api/v2.5/widget/[Link])
TreeNodeID (/api/v2.5/widget/[Link])
List My App (/submit/)
Fyne API "[Link]"
[Link]
import "[Link]/fyne/v2/widget"
Usage
type Button
type Button struct {
DisableableWidget
Text string
Icon [Link]
// Specify how prominent the button should be, High will highlight the button
and Low will remove some decoration.
//
// Since: 1.4
Importance Importance
Alignment ButtonAlign
IconPlacement ButtonIconPlacement
OnTapped func() `json:"-"`
}
Button widget has a text label and triggers an event func when clicked
func NewButton
func NewButton(label string, tapped func()) *Button
NewButton creates a new button widget with the set label and tap handler
func NewButtonWithIcon
func NewButtonWithIcon(label string, icon [Link], tapped func()) *Button
NewButtonWithIcon creates a new button widget with the specified label, themed icon and tap handler
func (*Button) CreateRenderer
func (b *Button) CreateRenderer() [Link]
CreateRenderer is a private method to Fyne which links this widget to its renderer
func (*Button) Cursor
func (b *Button) Cursor() [Link]
Cursor returns the cursor type of this widget
func (*Button) FocusGained
func (b *Button) FocusGained()
FocusGained is a hook called by the focus handling logic after this object gained the focus.
func (*Button) FocusLost
func (b *Button) FocusLost()
FocusLost is a hook called by the focus handling logic after this object lost the focus.
func (*Button) MinSize
func (b *Button) MinSize() [Link]
MinSize returns the size that this widget should not shrink below
func (*Button) MouseIn
func (b *Button) MouseIn(*[Link])
MouseIn is called when a desktop pointer enters the widget
func (*Button) MouseMoved
func (b *Button) MouseMoved(*[Link])
MouseMoved is called when a desktop pointer hovers over the widget
func (*Button) MouseOut
func (b *Button) MouseOut()
MouseOut is called when a desktop pointer exits the widget
func (*Button) SetIcon
func (b *Button) SetIcon(icon [Link])
SetIcon updates the icon on a label - pass nil to hide an icon
func (*Button) SetText
func (b *Button) SetText(text string)
SetText allows the button label to be changed
func (*Button) Tapped
func (b *Button) Tapped(*[Link])
Tapped is called when a pointer tapped event is captured and triggers any tap handler
func (*Button) TypedKey
func (b *Button) TypedKey(ev *[Link])
TypedKey is a hook called by the input handling logic on key events if this object is focused.
func (*Button) TypedRune
func (b *Button) TypedRune(rune)
TypedRune is a hook called by the input handling logic on text input events if this object is focused.
Improve this page ([Link]
If you like the Fyne toolkit please consider sponsoring ([Link] our work.