| title | Button | ||
|---|---|---|---|
| description | A basic native button that reacts to user gestures. | ||
| contributors |
|
<Button> is a UI component that displays a button which reacts to user gestures.
For more information about the available gestures, see Gestures.
<<< @/../examples/typescript/src/ui/Button/template.xml#example <<< @/../examples/angular/src/ui/Button/component.html#example <<< @/../examples/react/src/components/ui/button.tsx#example <<< @/../examples/solid/src/ui/button.tsx#example <<< @/../examples/svelte/app/components/ui/Button.svelte#example <<< @/../examples/vue/src/ui/Button/component.vue#example
If you need to style parts of the text, you can use a combination of a FormattedString and Span elements.
<Button>
<FormattedString>
<Span text="This text has a " />
<Span text="red " style="color: red" />
<Span text="piece of text. " />
<Span text="Also, this bit is italic, " fontStyle="italic" />
<Span text="and this bit is bold." fontWeight="bold" />
</FormattedString>
</Button>text: stringSets the text shown in the button.
textWrap: booleanGets or sets whether the button should wrap longer text to new lines.
Default value is false.
isEnabled: booleanAllows disabling the button. A disabled button does not react to user gestures.
Default value is true.
For additional inherited properties, refer to the API Reference.
on('tap', (args: TapGestureEventData) => {
const button = args.object as Button
console.log(`The button has been tapped!`)
})Emitted when the button is tapped
See TapGestureEventData.
- Android:
android.widget.Button - iOS:
UIButton

