Skip to content

Quick reference

Every gg-* attribute the library reads or writes, what reads it, and what shape it expects. One page so you (or an LLM helping you) can scan the whole vocabulary at once.

Data binding

AttributeOnReads / writesNotes
gg-data="<id>"containerreadsRuns query <id>, expects single object. Populates [gg-field] and [gg-switch-field] descendants.
gg-data-list="<id>"containerreadsRuns query <id>, expects array. Clones [gg-list-template] per record.
gg-data-form="<id>"<form> or containerreadsRuns query <id>, expects single object. Pre-fills inputs by name.
gg-data-on="<key>,..."same as abovereadsRe-runs the query whenever any listed URL param changes.
gg-field="<dot.path>"descendantwrites textContentSet from the parent record. Skipped if the path resolves to null/undefined.
gg-list-templatechild of gg-data-listThe template element to clone per record. The original stays in the DOM (hidden via the engine).

Record shape: plain object. Dot-paths are split by . and walked with getPath. Arrays for gg-data or gg-data-form produce a console.warn.

Reading the record from custom code: every gg-data, gg-data-form, and cloned gg-data-list row sets element.__ggRecord and dispatches a bubbling gg-data-ready CustomEvent (with detail.record) on itself after the query resolves. Web components / React islands listen on the container (e.g. host.closest("form")) to hydrate their own state.

Actions

AttributeOnReads / writesNotes
gg-action="<id>"any elementreadsOn click, runs action <id>. Walks ancestors for a __ggRecord and merges with gg-action-data.
gg-action-data="k1:v1,k2:v2"same elementreadsInline data merged on top of the parent record. Values are strings.
gg-confirmelement with gg-action or gg-form-actionreadsIf present, calls window.confirm() before firing.
gg-confirm-text="<msg>"samereadsConfirmation message. Defaults to "Are you sure?".

Action handler shape: (context, data, params) => { ok: boolean, error?: unknown } \| void. Returning { ok: false } triggers onError.

Form actions

AttributeOnReads / writesNotes
gg-form-action="<id>"<form>readsOverrides submit, runs form action <id> with a FormData snapshot.
gg-form-field-invalidinput/select/textareawrittenSet by the engine after a field_errors failure. Cleared on next input.
gg-form-field-error="<name>"elementwritten textContentReceives the message for field <name>.
gg-form-errorelementwritten textContentReceives the top-level error message.
gg-form-error-listcontainerreadsCloning target — see gg-list-template — for rendering one element per field_errors entry.
gg-form-scopecontainerreadsUsed by gg-visible-when to scope its lookups.

Form action handler shape: (context, formData, params) => { ok: boolean, error?: unknown, field_errors?: { name, message }[] } \| void.

URL params

AttributeOnReads / writesNotes
gg-query-set="k1:v1,k2:v2"clickablereadsOn click, sets the listed params.
gg-query-remove="k1,k2"clickablereadsOn click, removes the listed params.
gg-query-bind="<key>"input/select/textareareads + writes URLTwo-way binding between input value and URL param.
gg-query-debounce="<ms>"same inputreadsDebounce ms for gg-query-bind.

Modal param: ?modal=... is reserved — the dialog engine watches it and opens/closes the page's <dialog> element. ?id is removed alongside modal on dismiss.

Switcher

AttributeOnReads / writesNotes
gg-switch-state="<value>"containerreads + writtenChildren with a matching gg-case are shown; others hidden.
gg-switch-field="<dot.path>"container inside gg-datareadsWrites the path's value onto gg-switch-state. Comma-separated paths are joined positionally.
gg-switch-query="<key>"containerreadsMirrors a URL param onto gg-switch-state. Comma-separated keys are joined positionally.
gg-case="<value>"child of a switchreadsVisible when its value matches the parent's gg-switch-state. Empty string = default. Comma = positional AND, | = OR alternatives within a position.

Visibility

AttributeOnReads / writesNotes
gg-visible-when="name1:value1,..."element inside <form> or [gg-form-scope]readsShown if any condition matches. Fades opacity over 200ms; sets inert + aria-hidden while hidden.

Status

AttributeOnReads / writesNotes
gg-loadingtrigger / formwrittenSet to "true" while a handler is in flight. Buttons / inputs also get the native disabled attribute.
gg-auth<body>written"true" when a user is signed in, "false" otherwise.
gg-auth="true" / "false"any elementreadsHidden via inline display: none when its value doesn't match body[gg-auth].
gg-role="<role>"<body>writtenThe string returned by auth.roleQuery. Removed when no role / signed out.
gg-role="<role>"any elementreadsHidden when the value doesn't match body[gg-role]. Comma-separate for OR, e.g. gg-role="admin,editor".

Inbound events

Custom events the library listens for. Dispatch from your own code to drive the engine:

EventWhere to dispatchEffect
gg:dialog:opendocumentOpens the page's <dialog> (without touching the URL).
gg:dialog:closedocumentCloses the page's <dialog> (without touching the URL).
gg:shadow:clickdocument, with detail.target = <Element>Forwarded click for elements inside a shadow root, since shadow DOM swallows bubbling clicks.
webflow:emitdocument, with detail.event = "<ix-event-name>"Bridged into Webflow IX (Webflow.require("ix3").emit).

Outbound events

Custom events the library dispatches. Listen from your own code to react to engine state:

EventWhere dispatchedDetailWhen
gg-data-readythe gg-data / gg-data-form container or cloned gg-data-list row{ record }After the query resolves and __ggRecord has been written. Bubbles, so a single listener on a parent can observe many containers.
gg-app-readydocument{ app }Fired once during init() after the App is built. The same App is also set as window.ggApp. Skip both with init({ expose: false }).

Released under the MIT License.