Topic: MDBAlert in react

WingedImagination priority asked 1 year ago


Hi, I am trying to get an alert like it is in the example Alerts> Placement (https://mdbootstrap.com/docs/b5/react/components/alerts/) - alert that is sticked to the top-right of the screen. Unfortunately, this cannot be obtained by using the code that is in the 'show code' (alert is shown under the button or at the very end of the page - depend of 'appendToBody').

1) So how can I get this effect?

2) How to trigger alert by function without buttons?


Krzysztof Wilk staff answered 1 year ago


Hi!

  1. Can you create a code example of your problem? Or share your code with me? I tried the code from here https://mdbootstrap.com/docs/b5/react/components/alerts/#section-placement on the fresh package and everything works as expected.

  2. You can use the show property to manually handle your alert. I.e. you can use the state to achieve that: <MDBAlert position='top-right' show={someShowState}>...</MDBAlert> :)

Keep coding!


WingedImagination priority commented 1 year ago

Hi! Thank you for your answer. After updating all the modules, it started to work. Thanks for your time and have a nice day.


Krzysztof Wilk staff commented 1 year ago

Hi!

Glad I could help. If you have more questions - feel free to ask :)

Keep coding!



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Resolved

Specification of the issue

  • User: Priority
  • Premium support: Yes
  • Technology: MDB React
  • MDB Version: MDB5 3.0.0
  • Device: macbook
  • Browser: google chrome
  • OS: macOS
  • Provided sample code: No
  • Provided link: Yes