Skip to content

Type to search the docs, API, and blog.

↑↓ navigate↵ openesc close
  • Zazz 0.16 alpha

    API

    Global attributes

    The attributes no primitive owns.

    Everything a primitive owns is data-<primitive>-*. A few attributes belong to the page instead. Each is named for what it sets and takes the choice as its value.

    Global attributes
    AttributeValuesWhat it does
    data-themedark light Pins the color scheme for this element and everything inside it; scopes nest. Without it the system setting applies.
    data-navigationswap off On <html>, swap: replace the body in place on navigations between opted-in pages. On a region, off: leave its links and forms to the browser.
    data-navigation-persistfree valueKeep this element's live DOM, state and scroll offsets across in-page navigations; its links take aria-current from the next page. The value is an id both pages share.
    data-navigation-persist-modeelement scroll Used with data-navigation-persist. "scroll" renders this element from the next page and keeps only its scroll offset (a section sidebar, a table of contents); "element", the default, keeps the element itself.
    data-draggablefalse Keeps a press inside this element from dragging the drawer, toast, or carousel around it.
    data-style-guardoff Opts an element out of the style guard.

    Theme

    On any element, data-theme="dark" or data-theme="light" pins that scheme for the subtree; it only sets color-scheme, so scopes nest and every light-dark() token follows. Without one, the page follows the system. The head's theme script sets it on <html> from localStorage.theme before first paint.

    With data-navigation="swap" on <html>, a same-origin navigation between two opted-in pages fetches the destination and swaps the whole <body> in place. Nothing survives the swap unless it carries data-navigation-persist="<id>" on both pages; then the live element moves into the new page with its state and scroll offsets, and its links take aria-current from the new page. Adding data-navigation-persist-mode="scroll" renders the element from the new page and keeps only its scroll offset, for a region whose content changes per page, such as a sidebar. Reloads, hash changes, downloads, and form posts are never intercepted, nor is a link or form inside data-navigation="off". See navigation.

    Drag opt-out

    data-draggable="false" keeps a press inside the element from starting a drag: a drawer stays still, a toast is not swiped away, and a carousel track does not follow the mouse. Use it on a region that needs the pointer for itself, such as a map or selectable text. A bare data-draggable does nothing.

    Style guard

    data-style-guard="off" opts an element out of the style guard, which otherwise restores style utilities a legacy script overwrites, and of the CSP fallback.

    API