domestic-ui GitHub

Web components

HTML still has no element for tabs, menus, roving focus in a toolbar, hover tooltips or a toast stack. For those, and only those, web-components/ has one small custom element each: <dui-tabs>, <dui-menu>, <dui-combobox>, <dui-toolbar>, <dui-tooltip>, <dui-toaster>, <dui-table> (sorting rows and selecting them, which a <table> cannot do) and <dui-app-shell> (collapsing sidebars and turning them into modal drawers on a narrow shell, which a button cannot do by itself). HTML does have <datalist>, but its popup cannot be styled and differs between engines, so <dui-combobox> upgrades it to a listbox the page owns.

  • Light DOM. No shadow root. The molecule CSS and your CSS style the markup directly.
  • Progressive enhancement. The markup works before the script runs and with JavaScript off: tabs are a <nav> of in-page links and headed sections, toolbar buttons are Tab stops, a menu's popover still opens, a tooltip is still the button's description, a data table keeps the server's order with plain-text headers and ordinary checkboxes, an app shell shows both sidebars and no toggles.
  • ARIA with behavior, or not at all. An element adds roles such as menu or tab only together with the keyboard support those roles promise (APG).
  • Why each exists is written at the top of its file, and the web components index lists them. Each one is a plain ES module with no dependencies and no build: <script type="module" src="web-components/dui-tabs.js"></script>.

Search