How would you build a reusable modal dialog component that can be opened and closed?

Technical