GitHub, 7 stars
Light themes
Dark themes

Make your own

Building components in plain HTML

How to build menus, dialogs, tabs, a combobox, a date picker and other components in plain HTML, CSS and JavaScript, accessible from the start.

Components

Modal dialogs in plain HTML: focus and Escape

The dialog element and showModal(): the top layer, an inert page, Escape, focus on open and on close, a name, the backdrop, scroll lock and alert dialogs.

Vladyslav KorzhMaintains Tray UI7 minutes to read

More articles

12 more on this page, newest first.

Components, 8 minutes

An autocomplete combobox without a library

An autocomplete combobox in plain HTML and JavaScript: role="combobox", a listbox, aria-activedescendant, filtering, the keys and a spoken count.

Components, 8 minutes

A date picker in plain HTML and JavaScript

When <input type="date"> is enough, and how to build a calendar grid: arrow keys, Page Up and Down, Home and End, month buttons, the date in the name.

Components, 7 minutes

Accessible tabs in HTML: roles and arrow keys

Tabs in plain HTML and JavaScript: tablist, tab and tabpanel, aria-selected, a roving tabindex, the arrow keys, Home and End, and when tabs should be links.

Components, 6 minutes

A command palette (Cmd+K) in plain HTML

A command palette opened with Cmd+K or Ctrl+K in plain HTML: a modal dialog, a combobox over a listbox, filtering, groups and aria-activedescendant.

Components, 8 minutes

Nested submenus that work from the keyboard

A submenu in plain HTML and JavaScript: its markup, the keys that open and close it, aria-expanded, where focus goes, and the pointer, with Tray UI's menus.

Components, 7 minutes

Accessible tooltips that pass WCAG 1.4.13

A tooltip in plain HTML and JavaScript that meets WCAG 1.4.13: hoverable, dismissible with Escape, persistent, tied to its control, and what to use instead.

Components, 6 minutes

A custom select that says its value

A custom select in HTML and JavaScript whose button says its label and its value, the keys of its list, and when the native select element is the better choice.

Components, 8 minutes

Tag input: chips, a limit and spoken errors

A tag input in plain HTML and JavaScript: chips with a remove button, Backspace, a limit, repeats, and errors marked on the text field and said aloud.

Components, 7 minutes

A slider that says its unit with aria-valuetext

A native range input that says "30 km" where it would say "30": aria-valuetext, a visible value, words for the steps, the keys, and Tray UI's slider.

Components, 7 minutes

A paginated data table that keeps focus

A sortable, paged data table in plain HTML that keeps focus where the person is, says each new sort and page aloud, and stays a real table throughout.

Components, 7 minutes

A one-time code input with paste and autofill

A one-time code field that takes a typed code, a pasted one and SMS autofill: one-time-code, inputmode, cells or one field, and why one field can be better.

Components, 7 minutes

Show password: aria-pressed or a new label

A show password button in HTML: a constant name with aria-pressed, or a name that changes to Hide password. What each says, and which Tray UI uses where.

Articles 1 to 13 of 17

New articles in a feed

Add the Atom feed to a feed reader, and each new article comes to you whole, with its code.

Open the feed

GitHub7 stars

↑↓ to moveEnter to openEsc to close