Modal reusability
See original GitHub issueGiven a list of item, each have a part defined as
<a href="#itemModal" data-id={ item._id ">{ item.name }</a>
and the modal is manually defined as
<div id="itemModal" className="modal modal-fixed-footer">
<div className="modal-content">
<h4>Edit Model</h4>
<form> ... </form>
</div>
<div className="modal-footer">
<a href="#!" className="modal-action modal-close waves-effect waves-green btn-flat ">Close</a>
</div>
</div>
At the moment, the Modal component seem to require a trigger prop.
How can this component be reusable? I don’t want to create 500 if I have 500 items in my list.
Edit
A suggestion could be to have trigger be optional, and allow a selector prop to use when initializing the overlay with Materialize’s leanModal.
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Building a Reusable Modal Component with Dynamic Content ...
I recently came across the use case for a modal in one of my personal projects — the usual 'are you sure you...
Read more >Create Reusable MODALS in REACT JS | by Shmoji - codeburst
Hello, Shmoji here. Today we are going to be creating reusable modals using React. In case you didn't know, the GIF above is...
Read more >Developing Reusable and Customizable Modals With React ...
Create reusable and customizable modals with React and TypeScript. Learn how to make a complete modal with React Portals and styled-components.
Read more >Reusable Modal Component - CodePen
URL Extension Required. When linking another Pen as a resource, make sure you use a URL Extension of the type of code you...
Read more >Create a reusable modal with LiveView Component
In LiveView that is called a LiveComponent. In this tutorial I will go through how to set up reusable modal in Phoenix LiveView...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@yanickrochon So the only requirement is to make the
triggerproperty optional, right? We can make it happen.Bump.