Button

Note: You can check the Avalonia docs for the Buttonarrow-up-right and Button APIarrow-up-right if you need more information.

For Avalonia.FuncUI's DSL properties you can check Button.fsarrow-up-right

Buttons are basic controls for any application you may build, buttons are often used to trigger an action.

Usage

You can check the general usage of Avalonia.FuncUI's views and attributes in the following link Views and Attributes

Create a Button

Button.create []

Register Click

Button.create [
  Button.onClick(fun _ -> dispatch MyMsg)
]

Set Click Mode

Button.create [
  Button.clickMode ClickMode.Press
]
// or
Button.create [
  Button.clickMode ClickMode.Release
]

for more information check the Click Modearrow-up-right docs

Set Content

Buttons can have arbitrary content, for example it can be a string as the example above. It also can be another entire control like a StackPanel

Last updated