Skip to main content

Schema outline

The fields of an asset's schema as a readable outline, with a field panel and JSON/YAML views.

Guidance​

The schema outline is the Schema tab of an asset, for flat SQL tables and deep Avro or JSON schemas alike. Each field reads as two lines: its name, its type in everyday words ("Text", "Money (GBP)", "List of line item", "One of 3 values: WEB, IOS, ANDROID") and markers (Key, PII, Certified), then its description with glossary terms beside it. Only exceptions are marked: "Optional" for a nullable field, "Edited" for a description a person changed, and the filled share when a field has gaps. Groups fold into a tree only where nesting exists, with a hairline guide per level; top-level groups start open. density="compact" shows one line per field for wide tables.

Selecting a field opens a side panel with the exact type, its values (filled share, distinct count, range, histogram, allowed values, default), who can see it, glossary terms and a copyable path. A Structure, JSON and YAML switch shows the schema as text with a copy button, from source (the original Avro or JSON Schema document) when given, or from columns.

It is an ARIA treegrid (https://www.w3.org/WAI/ARIA/apg/patterns/treegrid/) with row focus: one tab stop; Down and Up move between rows, Home and End go to the first and last; Right expands a group or moves to its first field, Left collapses it or moves to its parent (flipped in right-to-left); Enter opens the field panel and Escape closes it, returning focus to the row.

Properties​

PropertyAttributeTypeDefaultDescription
columnsSchemaColumn[][]The fields.
sourceunknownThe schema as its source wrote it (an Avro or JSON Schema document, as an object or a JSON string), for the JSON and YAML views. Without it they show columns.
viewview'structure' | 'json' | 'yaml''structure'The outline, or the schema as JSON or YAML text with a copy button.
densitydensity'comfortable' | 'compact''comfortable'compact shows one line per field, for wide tables.
labellabelstring''Accessible name. Defaults to "Schema".
editableeditablebooleanfalseShows "Edit description" in the field panel.
filterfilterstring''Finds fields by name, including nested ones.
piiOnlypii-onlybooleanfalseShows only fields that hold personal data.
keysOnlykeys-onlybooleanfalseShows only key fields.
selectedselectedstring''The path of the field open in the panel.
hideToolbarhide-toolbarbooleanfalse
loadingloadingbooleanfalse
errorerrorstring''Error text; shows a retry button.
emptyTextempty-textstring''Empty state sentence.

Methods​

MethodDescription
expandAll()Expands every group.
collapseAll()Collapses every group.

Events​

EventDetailDescription
mm-select-fieldCustomEvent<MmSelectFieldDetail>A field was opened in the panel.
mm-edit-descriptionCustomEvent<MmEditDescriptionDetail>The person asked to edit a field's description.
mm-retryCustomEvent<null>The retry button in the error state was activated.

CSS parts​

PartDescription
toolbarThe find, filter and view row.
outlineThe treegrid.
panelThe field panel.
textThe JSON or YAML view.

CSS custom properties​

PropertyDescription
--mm-schema-table-heightHeight at which the outline scrolls. Defaults to none.

Examples​

Every state of mm-schema-table in Storybook, with keyboard and screen reader tests.