# 6 UI parts that no longer need JavaScript

> Native HTML handles accordions, modals, popovers, date pickers, color pickers, and form validation.

Source: https://fullbytedeveloper.com/blog/html-ui-without-javascript
Keyword: NOJSKIT
Published here: 2026-11-10

These six UI patterns used to require JavaScript libraries. Now they work with plain HTML.

## 1. Accordion (details and summary)

The `details` element expands and collapses content. Add the same `name` attribute to make only one open at a time [1] [2]:

```html
<details name="faq">
  <summary>Question one</summary>
  <p>Answer one.</p>
</details>
<details name="faq">
  <summary>Question two</summary>
  <p>Answer two.</p>
</details>
```

You should see clickable summaries that expand to show their content.

## 2. Modal dialog

The `dialog` element with `showModal()` creates a modal with a backdrop. For a declarative open, use a form with `method="dialog"` [4]:

```html
<dialog id="confirm">
  <p>Are you sure?</p>
  <form method="dialog">
    <button value="cancel">Cancel</button>
    <button value="confirm">Confirm</button>
  </form>
</dialog>
<button onclick="document.getElementById('confirm').showModal()">Open</button>
```

You should see a centered dialog with a dimmed backdrop when opened.

## 3. Popover (no modal)

The `popover` attribute creates a non-modal overlay. Use `popovertarget` on a button to toggle it without JavaScript [3]:

```html
<button popovertarget="menu">Open menu</button>
<div id="menu" popover>
  <p>Menu content</p>
</div>
```

You should see the popover appear when clicked, and close when clicking outside.

## 4. Date picker

The `date` input type shows a native calendar picker on desktop and mobile:

```html
<input type="date" name="start">
```

You should see a date picker when the field is focused.

## 5. Color picker

The `color` input type opens a native color selector:

```html
<input type="color" name="theme" value="#3b82f6">
```

You should see a color swatch that opens a picker when clicked.

## 6. Form validation

Required fields, email format, and pattern matching work without JavaScript:

```html
<form>
  <input type="email" required placeholder="Email">
  <input type="text" pattern="[0-9]{5}" placeholder="ZIP code">
  <button type="submit">Submit</button>
</form>
```

You should see browser validation messages when submitting invalid input.

Send this to the friend installing a JavaScript library just to build a modal or accordion.

## Sources

1. [MDN: details element](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/details)
2. [MDN blog: exclusive accordions using the HTML details element](https://developer.mozilla.org/en-US/blog/html-details-exclusive-accordions/)
3. [web.dev: popover and dialog](https://web.dev/learn/css/popover-and-dialog)
4. [MDN: dialog element](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/dialog)
