Home App Docs Blog Github

Is there a way to add toast notifications to forms?

hey there guys :slight_smile: is there a way to add toast messages to forms in builder?

something like this:

thanks in advance

Linda

Hi @creativemac , great question, and yes! You can.

It is possible to add custom objects and entire libraries through Context for a custom Builder Component

So in this example, you could do something along the lines of

const { addToast } = useToasts();
  <BuilderComponent 
       context={{ addToast }} ... >

You would then have access to the Toasts library in actions and bindings as context.addToast, for example

context.addToast("Here is your toast message")

Hopefully that helps. You can find further information on adding more custom code throughout Builder here: Adding custom code in the Builder.io visual editor - Builder.io

Thank you so much i am going to give it a whirl immediately :slightly_smiling_face::slightly_smiling_face::slightly_smiling_face::slightly_smiling_face:

1 Like