Exactly! In order to display icons, you should first choose your icon position in the button, then click on the icon, and select the one you want to use.
For the second question, you can give your component a serverRef, and call a function, where you do checkups on the privileges given to the connected session, and then hide and show that component.
In the following example, we check whether the current session has as privilege the manageRessources one, if that’s the case we display the component named “displayForAdmin”, by removing that css class:
In the example you provided, we are simply hiding the element using CSS, so there is nothing preventing the user from re-displaying the element by modifying its style. Doesn’t this pose potential issues?
In many back-end languages, it is possible to modify the HTML file before display.
It would be beneficial to have the ability to delete (not hide) a designated element, perhaps identified by its server-side name, in the Qodly code using a .delete() method, for example.
It would also be advantageous to potentially dynamically add pre-constructed components during page display, which we can prepare ourselves in the “Crafts” category of components.
But currently, with Fadwa’s example, if we want to block the use of the button, we simply need to check the user’s permissions before performing the button’s action. This solution will work well in this case.