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
Data Architect
@ University of Texas at Austin | Austin, TX
Data ETL Engineer
@ University of Texas at Austin | Austin, TX
Lead GNSS Data Scientist
@ Lurra Systems | Melbourne
Senior Machine Learning Engineer (MLOps)
@ Promaton | Remote, Europe
Sr. VBI Developer II
@ Atos | Texas, US, 75093
Wealth Management - Data Analytics Intern/Co-op Fall 2024
@ Scotiabank | Toronto, ON, CA