Modifying HTML
BellJs is now completely customizable with that in mind you can recreate most alerts on the web.
How is this possible?
Two new properties were added for the third parameter of Bell
, these properties customize this alert to the maximum, if you are wondering which properties I am talking about, I am referring to customIcon
, customClass
, customStyles
and the most powerful customHTML
, using them you can generate incredible and adaptable alerts.
Changing styles with customStyles
You can change the styles of your Bell
alerts using this property, any existing CSS style property can be used, although compatibility will depend on the browser. Let’s see an example:
You can modify any of the CSS properties that are present in the elements in the alert you have created from the title to the icons.
Changing the default icons
BellJs has 5 default icons, these being info
,warning
,success
,error
,promise
each of them for a respective action and style. You may want to improve the customization by changing the icons. To change them you just have to modify them from the customIcon
property, let’s see an example:
With this we will change the icons only or globally for all alerts.
Alert with events using customHTML
The greatest customization of Bell
is achieved by using the customHTML
property, since with this we completely clean the alert and design a new one to our liking, of course with all the benefits already proposed above. Let’s create an alert like Vercel’s together:
The first thing we need to do is create the new HTML and CSS:
With this we already have the structure of our Vercel alert, the next thing to do is to change the alert for this new HTML, this is done in the following way:
You can see that the alert has changed completely, now it is up to you what you want to design.