sweetalert icon indicating copy to clipboard operation
sweetalert copied to clipboard

button className is not working

Open adrianmak opened this issue 6 years ago • 3 comments

I tried to add bootstrap button class on the button. But it didn't work Checked the html output source, my custom class names are not added

 swal({
                text: "Form has not completed. Submission failed",
                icon: "warning",
                button: {
                    confirm: {
                        text: "OK",
                        className: "btn btn-primary",
                    },
                }
            });

adrianmak avatar Mar 29 '18 21:03 adrianmak

Hi, I am also having the same issue.

swal({ title: 'Recover Item', text: 'Would you like to recover the selected items?', buttons: { confirm: { text: "Yes", value: true, visible: true, className: "bg-warning", closeModal: true, }, cancel: { text: "Cancel", value: true, visible: true, className: "bg-default", closeModal: true, } } }, function () { ... });

hannahmay avatar Apr 26 '18 09:04 hannahmay

className failed to take more than one classes. Failed to execute 'add' on 'DOMTokenList': The token provided ('btn btn-success') contains HTML space characters

vlcheong avatar May 14 '18 02:05 vlcheong

`const swalWithBootstrapButtons = Swal.mixin({ customClass: { confirmButton: 'btn btn-success', cancelButton: 'btn btn-danger' }, buttonsStyling: false })

swalWithBootstrapButtons.fire({ title: 'Are you sure?', text: "You won't be able to revert this!", icon: 'warning', showCancelButton: true, confirmButtonText: 'Yes, delete it!', cancelButtonText: 'No, cancel!', reverseButtons: true }).then((result) => { if (result.isConfirmed) { swalWithBootstrapButtons.fire( 'Deleted!', 'Your file has been deleted.', 'success' ) } else if ( /* Read more about handling dismissals below */ result.dismiss === Swal.DismissReason.cancel ) { swalWithBootstrapButtons.fire( 'Cancelled', 'Your imaginary file is safe :)', 'error' ) } })`

Add class in customClass

Nemachtilli avatar Jan 23 '23 04:01 Nemachtilli