NativeScript Angular


A Button component provides an easy-to-use way for interacting through the application and invoking custom logic in response to that. Once the user taps it, the button performs any actions attached to it.


Tap Event

A button component can attach to custom logic with its tap event. Handling the event is as easy as using (tap) in HTML, and implementing a tap handler in your component.

Attaching to the tap event handler from HTML:

<Button class="btn btn-primary btn-active" id="button" text="Tap me!" (tap)="onTap($event)"></Button>

Implementing the tap event handler in a component:

onTap(args: EventData) {
    let button = <Button>args.object;

    alert("Tapped " + this.counter + " times!");

Improve this document

Demo Source

API Reference for the Button Class

Native Component

Android iOS
android.widget.Button UIButton