Ionic-framework: Button: change button to an ion-button component

Created on 29 Jul 2016  ·  3Comments  ·  Source: ionic-team/ionic-framework

This will make it easier for users to have their own custom buttons instead of overriding our styles.

  • <a button> becomes <a ion-button>
  • <button> becomes <button ion-button>

Most helpful comment

Hey @mpaland, thanks for the suggestion! The short answer is that using an attribute selector rather than an element selector allows us to gain all of the advantages of the native <button> and <a> elements, rather than passing all of the native functionality down and being difficult to maintain. This is something we have decided to do in line with the material team's implementation. They have put together a great document explaining the various reasons for this: https://docs.google.com/document/d/1m8IxhKu5qI8xwjePVGZMbRve3MTW9M8odgcPiuAZfoM/preview?pref=2&pli=1#

All 3 comments

@brandyscarney, wouldn't it be cleaner and more consistent to have a <ion-button> element instead of a <button ion-button> like

<ion-button>
  Right Icon
  <ion-icon name="star"></ion-icon>
</ion-button>

This may render a <button ion-button> behind the scenes.

Hey @mpaland, thanks for the suggestion! The short answer is that using an attribute selector rather than an element selector allows us to gain all of the advantages of the native <button> and <a> elements, rather than passing all of the native functionality down and being difficult to maintain. This is something we have decided to do in line with the material team's implementation. They have put together a great document explaining the various reasons for this: https://docs.google.com/document/d/1m8IxhKu5qI8xwjePVGZMbRve3MTW9M8odgcPiuAZfoM/preview?pref=2&pli=1#

Brandy, thanx for pointing this out. Kara's doc makes your decision pretty clear. IMHO not 100% nice - but necessary.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SebastianGiro picture SebastianGiro  ·  3Comments

Macstyg picture Macstyg  ·  3Comments

alan-agius4 picture alan-agius4  ·  3Comments

danbucholtz picture danbucholtz  ·  3Comments

GeorgeAnanthSoosai picture GeorgeAnanthSoosai  ·  3Comments