Title

A heading; the variant sets its level.

When to use it

A heading where the text between components is not enough, with its level set by the variant.

When not to

Headings in the running text, which you write as headings directly. Keep one main heading per page and do not skip levels.

Accessibility

A real heading of the level you choose, so the page's outline, the table of contents and screen readers' heading lists stay right.

See it live

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

The title 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. One row, its cells in the order of the fields.

Field

Key

Kind

Required

Title

title

Plain text, one line

Yes

Variants

A variant changes how the component looks. Write it in parentheses after the name in the table’s first cell, several separated by commas.

Variant

Write in the first cell

Level 1 (page title)

title (1)

Level 2

title (2)

Level 3

title (3)

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

invalid_title_level

Title level "{value}" is not between 1 and 6; level 2 is used.

In Google Docs

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

title

Our adventures

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": "title",
  "variants": [
    "1"
  ],
  "rows": [
    [
      "Our adventures"
    ]
  ]
}

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

title

The component

title--1

A variant

title--2

A variant

title--3

A variant

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

html
<h2 class="title">Our adventures</h2>

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/title.js
  • src/components/title/title.liquid