wireui / wireui

TallStack UI components
https://v1.wireui.dev
MIT License
1.37k stars 167 forks source link

How pass parameters to modal? #855

Open LeoMachado94 opened 3 months ago

LeoMachado94 commented 3 months ago

I need pass parameters to modal, and I tried many ways to this, but without success.

dfikeda commented 3 months ago

Prease verify if the documentation if it is relative for your version. The default instalation, installs the V1, and documentation is default for v2. Additionally, you must fill in the information in order to assist you in what you are actually trying to do, for example, what are these parameters?

LeoMachado94 commented 3 months ago

Right, I installed it as the v2 documentation asks, and in my composer I have "wireui/wireui": "^1.18". @dfikeda The documentation says that we can invoke $openModal('modal-name'). In this scenario, I have a modal that is used to exclude users, and I would like to use the same modal just informing the user's ID. I wouldn't like to have 10 exclusion modes for a list of 10 users, I understand that there would be too many unnecessary components. I would like to do something like $openModal('delete-users', $userId).

LeoMachado94 commented 3 months ago

At the moment I am using it as shown in the image below, but I understand that it would be much better to have 1 deletion modal component that would be reused for any user that needs to be removed, and not 10 components (1 for each user).

Screenshot 2024-01-20 at 21 45 16
dfikeda commented 3 months ago

You can use this package to dinamic modal: https://github.com/wire-elements/modal

LeoMachado94 commented 3 months ago

I thought about using it, I already use it in other projects. But ideally, wireui would do this too. Do you see any performance problems using it as shown in the image?