eink-ui

eink-ui

Switch to Web Component demos View Storybook

Theme: default Default Inverted High-contrast Set data-theme="..." on <html> for no-JS use.

Native dialog element

E-Ink rationale: The native <dialog> element is the correct semantic choice for modal content. On E-Ink devices, modals should be used sparingly because each open/close triggers a full page repaint. The ::backdrop is styled with a semi-transparent overlay to dim the background.

Note on interactivity: Opening and closing a dialog requires JavaScript (dialog.showModal() / dialog.close()). Since this library is CSS-only, the demos below show dialogs in their open state using the open HTML attribute. In production, you would call .showModal() to display the dialog with its backdrop overlay.

Interactive trigger with polyfill

Use data-dialog-target to open a dialog by id and data-dialog-close to close. The included eink-ui.dialog.polyfill.js enables the same behavior on browsers that lack native <dialog> support.

Polyfilled dialog

This dialog opens and closes via data-dialog-target + data-dialog-close.

Simple confirmation dialog

Shown inline with the open attribute. In production, this would appear as a centered modal with a backdrop.

Confirm deletion

Are you sure you want to delete this item? This action cannot be undone.

Dialog with form content

Dialogs can contain form fields. Use method="dialog" on the form so the submit button closes the dialog natively.

Add a note

Dialog with scrollable content

For long content, the dialog body scrolls independently.

Terms of service

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium.

Theme variants

Dialogs inherit theme tokens from their ancestor's data-theme.

Default
Default theme

Standard dialog appearance.

Inverted
Inverted theme

Light text on dark surface.

Implementation notes

The <dialog> element provides built-in focus trapping and Escape-to-close behavior when opened with .showModal(). The minimal JavaScript needed:

// Open
document.getElementById('my-dialog').showModal();

// Close
document.getElementById('my-dialog').close();

The ::backdrop pseudo-element is only visible when the dialog is opened via .showModal(). The open attribute alone (used in these demos) does not render the backdrop.

For E-Ink devices, consider whether a full-page navigation would be preferable to a dialog, since the modal open/close requires a full screen repaint regardless.