Sweetalert: [Feature Request] Customize class buttons

Created on 29 Jul 2015  路  7Comments  路  Source: t4t5/sweetalert

Is there a chance to be able to add class to confirm / cancel buttons? also disable inline styles.
Something like this:

  confirmButtonText: 'OK',
  confirmButtonColor: '#8CD4F5',
  confirmButtonClass: ' ',
  cancelButtonText: 'Cancel',
  cancelButtonColor: '#D0D0D0',
  cancelButtonClass: ' ',
  unstyleButtons: false,

Thanks!

Most helpful comment

+1
BTW, using confirmButtonColor: '' it removes the inline stuff ;)

All 7 comments

+1, specially for removing inline styling (should use classes)

+1

Pleeeeeeasse remove the inline styles!! I think it's a major issue. Everybody needs to restyle sweetalert who is using it seriously.

I'm using sass & bootstrap, so I would only need something like this:

.sweet-alert button.confirm {
@extend .btn-primary;
}
.sweet-alert button.cancel {
@extend .btn-default;
}

instead of copying pages of css code from bootstrap and setting !important everywhere (which is an easy-to-avoid anti-pattern) to do the same.

+1

+1
Shame this is ignored, it's a deal breaker, I cannot use this - editing styles on two places is bad idea, not to even mention inline styles.

+1
BTW, using confirmButtonColor: '' it removes the inline stuff ;)

Inline styles have been removed in SweetAlert 2.0. You can also add you own classes using the new button options. For more info, check out the upgrade guide

Was this page helpful?
0 / 5 - 0 ratings