Call to action

A highlighted call to action: a sentence and a button.

When to use it

A highlighted closing invitation at the end of a page or part: a sentence and one button.

When not to

The top of the page, which a hero does better, and more than one or two on a page: when everything is highlighted, nothing is.

Accessibility

The sentence is text and the action a real link; keep enough contrast in the variant's colours (themes check theirs).

See it live

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

The call to action 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

Text

text

Text with headings, lists, links and bold

No

Link

link

A link: its text and address

No

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

Green

cta (verde)

In Google Docs

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

cta

Ready for your next trip?

Book now (https://example.com/book/)

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": "cta",
  "variants": [
    "verde"
  ],
  "rows": [
    [
      "Ready for your next trip?",
      {
        "link": "Book now",
        "href": "https://example.com/book/"
      }
    ]
  ]
}

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

cta

The component

cta--verde

A variant

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

html
<aside class="cta"><p>Ready for your next trip?</p><a class="button" href="https://example.com/book/">Book now</a></aside>

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