all AI news
Taming the HTML dialog with React and TailwindCSS
Nov. 1, 2023, 6:26 p.m. | Lorenzo Rivosecchi
DEV Community dev.to
Today we are going to build a modal component using the native HTML <dialog>
element with React and TailwindCSS.
Step 1: Wrap the HTML dialog element
The HTML dialog is a bit tricky to work with, therefore is a good practice to create a wrapper that will give us a declarative API to work with.
Let's start by simply wrapping the element and passing all the props to it:
// Modal.tsx
import { ComponentPropsWithoutRef } from 'react'; …
a11y api build good html javascript practice react tailwindcss work wrapper
More from dev.to / DEV Community
Jobs in AI, ML, Big Data
Software Engineer for AI Training Data (School Specific)
@ G2i Inc | Remote
Software Engineer for AI Training Data (Python)
@ G2i Inc | Remote
Software Engineer for AI Training Data (Tier 2)
@ G2i Inc | Remote
Data Engineer
@ Lemon.io | Remote: Europe, LATAM, Canada, UK, Asia, Oceania
Artificial Intelligence – Bioinformatic Expert
@ University of Texas Medical Branch | Galveston, TX
Lead Developer (AI)
@ Cere Network | San Francisco, US