Facts

Key facts as label and value pairs.

When to use it

Key facts as label and value: a trip's length and level, a product's size, an event's date and place.

When not to

Long text and data with many columns, which belong in a table.

Accessibility

A description list, so each value is read with its label.

See it live

The component library shows this component in the default theme, in every variant: open it in the component library

The facts example as the component library shows it in the default theme

Where it is used

The starter sites that use it, each at a page that shows it:

Fields

What the component’s dialog asks for. In a Doc, keyed rows start with the key; rows in order follow the order below. Each row is one item, its cells in the order of the fields.

Field

Key

Kind

Required

Label

label

Plain text, one line

Yes

Value

value

Text with headings, lists, links and bold

Yes

Variants

This component has no variants of its own; a theme can add some.

Warnings it can raise

The editor and the build say these when a block of this component needs a fix. All warnings are listed in the warnings reference.

Code

What it says

incomplete_fact

The fact "{label}" has no value.

In Google Docs

A component is a table. Its first cell names it; the rows below hold its fields. This is the example table:

facts

Duration

7 days

Level

Moderate

In a page file

In a site kept as a folder or in Git, the same component is a block of the page’s JSON file:

JSON
{
  "name": "facts",
  "rows": [
    [
      "Duration",
      "7 days"
    ],
    [
      "Level",
      "Moderate"
    ]
  ]
}

Markup and classes

What the component writes takes these classes, for a theme’s CSS: the component’s own name, name__part for its parts and name--variant for each variant (the variant’s plain name is there too).

Class

What it marks

facts

The component

facts__item

A part of it

facts__term

A part of it

facts__value

A part of it

The HTML the example above writes, as the component library builds it in the default theme:

html
<dl class="facts">
<div class="facts__item"><dt class="facts__term">Duration</dt><dd class="facts__value"><p>7 days</p></dd></div>
<div class="facts__item"><dt class="facts__term">Level</dt><dd class="facts__value"><p>Moderate</p></dd></div>
</dl>

Extending it

Its files in SeedPage. A theme or a site changes the markup by giving a file of the same name (the Liquid part), and a new component can extend this one.

  • src/components/facts.js
  • src/components/facts/facts.liquid