Reference · SemText · Data & tables
<sem-data-source>
SemText element
You either write the data inside the element or point at a file with source. Doing both is an error the element reports clearly. With JavaScript off, the data still reads as text.
Example
Live render boots with JavaScript — the authored source is alongside.
variant: data-format="csv"
An RFC 4180 payload: quoted fields, `""` escapes, embedded commas and newlines, CRLF. The first record is the header; ragged rows pad with empty cells and drop extras. The table renders with the same caption, typed sort and schema JSON as the default `table` form.
Live render boots with JavaScript — the authored source is alongside.
variant: data-format="csv" data-header="false"
`data-header="false"` (csv only): the first row is data and headers synthesize `col-<n>` — the payload below gains a third row and columns named col-1…col-3. Default is `true`.
Live render boots with JavaScript — the authored source is alongside.
variant: data-format="yaml"
The YAML subset (block mappings and sequences, comments, quoted scalars, flow sequences of scalars) — a row payload must be a sequence of mappings; columns are the key union in first-seen order. Flow mappings, anchors, tags and block scalars reject with a clear error naming the construct.
Live render boots with JavaScript — the authored source is alongside.
variant: data-format="json" with data-path
A JSON array of objects is rows; with `data-path="data.items"` the tier first descends the dot/bracket path (`rows[2].entries` indexes too) into the nested response. An unknown path or out-of-range index is a clear error, never a silent blank.
Live render boots with JavaScript — the authored source is alongside.
variant: data-format="sql" (result-shape declaration)
A `sql` payload is not a result — it declares the shape of one: the projection column names, so the bucket exists for queries and joins before any rows do. The table renders headers-only by design; a non-SELECT statement rejects, and `SELECT *` mirrors the FROM bucket's columns when one is declared in the same container.
Live render boots with JavaScript — the authored source is alongside.
variant: data-type="rows" with data-columns
The structure declaration `rows` pins columns with `data-columns="name[:type][?]"` (`?` = nullable). Declared types override per-column inference — `metrics` has an empty `ready` cell, so `ready:boolean?` pins what inference would guess; columns the declaration omits keep their inferred type.
Live render boots with JavaScript — the authored source is alongside.
variant: data-type="yaml-schema"
A `yaml-schema` payload is an OpenAPI-style document: `schema:` declares the row (nested `properties:` flatten to dotted column paths — endpoint.host, endpoint.port), `data:` carries the records. A required property missing from a record warns and leaves the cell null.
Live render boots with JavaScript — the authored source is alongside.
variant: data-view="core" (named view on first paint)
Same payload as the primary, defaulting to the `core` view instead of `all`: only the Token and Max uses columns paint, and every column stays in the DOM with the native `hidden` on excluded cells. Two declared views render the `aria-pressed` button group above the table — pressing All reveals the rest.
Live render boots with JavaScript — the authored source is alongside.
variant: file/API source (empty body + source)
An empty body plus `source` is the file/API form: the enhance renders a `role="status"` pending region, fetches (one fetch per URL per page load unless `data-cache="no"`), resolves the format (explicit `data-format` wins, then file extension, then sniffing) and renders the table — or a `role="alert"` error naming the cause (fetch failure, non-2xx, parse, CORS). `javascript:`/`data:`/`blob:` schemes are refused; a `file://` document refuses to fetch. Kept Source-only: this deployment serves no /data/tokens.csv, and a 404 would stand in for the success path.
variant: authoring error — inline payload with source
A non-empty body together with `source` is an authoring error and renders a clear `role="alert"` error naming the conflict ("an inline payload and source=… are mutually exclusive — keep one") — never silently resolved. An unknown `data-format` is a clear inline error the same way, never a silent blank.
Live render boots with JavaScript — the authored source is alongside.
Source: spec/schema/sem-data-source.md