Skip to content

Anatomy

DataScope is the container of the Data family. It groups DataModel, DataBind, DataComputed and DataEffect descendants into one reactive widget, so they share a group without writing a JavaScript class. Use this map to see which parts belong inside a scope and how they nest.

Structure

DataScope                              data-component="DataScope"
├─ DataModel      (× n)                data-component="DataModel"      reads form inputs
├─ DataBind       (× n)                data-component="DataBind"       writes a value into the DOM
├─ DataComputed   (× n)                data-component="DataComputed"   transforms values
├─ DataEffect     (× n)                data-component="DataEffect"     runs on change
└─ DataScope      (× n)                nested scope                    (optional)

Parts

PartSelectorRequiredRole
Scopedata-component="DataScope"YesThe boundary. Descendants inherit its default group unless they set their own data-option-group.
Modeldata-component="DataModel"OptionalReads values from form inputs into the scope.
Binddata-component="DataBind"OptionalWrites a scoped value into the DOM.
Computeddata-component="DataComputed"OptionalDerives a value from the scope.
Effectdata-component="DataEffect"OptionalRuns code when a scoped value changes.
Nested scopedata-component="DataScope"OptionalDescendants resolve to the nearest DataScope boundary.

Descendants inherit the scope's group unless they define their own data-option-group. See the JavaScript API for group inheritance, keys and scoped data snapshots.