ons-button

Button component. If you want to place a button in a toolbar, use <ons-toolbar-button> or <ons-back-button> instead. Will automatically display as a Material Design button with a ripple effect on Android.

Tutorial

Buttons

Onsen UI provides <ons-button> element with different styles. To select a specific style you can set the modifier attribute.

See also

Attributes

Attributes are added directly to the element. You can do this in HTML or JS.

HTML: <ons-button someAttribute="true" anotherAttribute><ons-button>
JS: document.querySelector('ons-button').setAttribute('someAttribute', 'true')

Name Type Description
modifier String The appearance of the button. Optional.
ripple If this attribute is defined, the button will have a ripple effect. Optional.
disabled Specify if button should be disabled. Optional.

Properties

Properties are accessed on the element through JS, and should be get and set directly. For example: document.querySelector('ons-button').disabled.

Name Description
disabled Whether the button is disabled or not.

Preset Modifiers

Modifiers are set in the modifier attribute. To use more than one, separate them by spaces. For example:
<ons-button modifier="outline light"><ons-button>.

Name Description
outline Button with outline and transparent background
light Button that doesn’t stand out.
quiet Button with no outline and or background..
cta Button that really stands out.
large Large button that covers the width of the screen.
large--quiet Large quiet button.
large--cta Large call to action button.
material Material Design button
material--flat Material Design flat button

Need Help?

If you have any questions, use our Community Forum or talk to us on Discord chat. The Onsen UI team and your peers in the community will work together to help solve your issues.

For bug reports and feature requests use our GitHub Issues page.