πŸš€ 8.9 Released! β†’ ⚑️ New Node-API Engine Preview, πŸ“² ns widget ios, πŸ’… Tailwind v4 and more...
Read Announcement

<Button> is a UI component that displays a button which reacts to user gestures.

For more information about the available gestures, see Gestures.

xml
<Buttontext="This is a button!" />
html
<buttontext="This is a button!"(tap)="tapMe($event)"></button>
tsx
<button
onTap={() => {
alert('Button Clicked')
 }}
>
 Click Me
</button>
tsx
<buttonon:tap={() =>alert('button clicked')}>Click Me</button>
svelte
<buttontext="this is a button"on:tap={showAlert}></button>
vue
<Buttontext="This is a button!" @tap="showAlert"></Button>

Examples ​

Formatting text inside a Button ​

If you need to style parts of the text, you can use a combination of a FormattedString and Span elements.

xml
<Button>
 <FormattedString>
 <Spantext="This text has a " />
 <Spantext="red "style="color: red" />
 <Spantext="piece of text. " />
 <Spantext="Also, this bit is italic, "fontStyle="italic" />
 <Spantext="and this bit is bold."fontWeight="bold" />
 </FormattedString>
</Button>

Props ​

text ​

ts
text: string

Sets the text shown in the button.

textWrap ​

ts
textWrap: boolean

Gets or sets whether the button should wrap longer text to new lines.

Default value is false.

isEnabled ​

ts
isEnabled: boolean

Allows disabling the button. A disabled button does not react to user gestures.

Default value is true.

...Inherited ​

For additional inherited properties, refer to the API Reference.

Events ​

tap ​

ts
on('tap', (args:TapGestureEventData) => {
constbutton= args.object asButton
 console.log(`The button has been tapped!`)
})

Emitted when the button is tapped

See TapGestureEventData.

Native component ​

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /