Guide

Replacing placeholders and moving sections

Every grey tile in the library is an image slot, and every page is a list of sections you can reorder or leave out. Both work the same way in React and in the web components.

Image slots

A picture takes src, alt (empty when it is decoration), fit (object-fit: cover by default, or contain, fill, none, scale-down) and position (object-position). Lists of pictures take arrays of these, one per entry. Without src an item keeps its placeholder.

No src: the placeholder
src (the brand's own light tile)
fit="contain" position="top"

An example in both flavors

Pages take sections (the keys in order; a key left out is not shown) and their pictures as part of their data: content where the page owns the copy, blocks where it is made of blocks with their own data, and menus for the header's menus.

React
import { HomePage } from '@/components/pages/HomePage'
import { CreativeCard } from '@/components/site/CreativeCard'

// One picture: src, alt, and where it sits in its box.
<CreativeCard src="/ads/acme-spring.jpg" alt="Acme spring sale ad" fit="cover" position="50% 20%" />

// A page: its sections in the order you want (leave one out to drop it), and each block's pictures.
<HomePage
  sections={['hero', 'stories', 'pricing', 'faq', 'close']}
  blocks={{
    stories: { cases: [{ company: 'Acme', href: '/customers/acme', picture: { src: '/team.jpg', alt: 'The Acme team', position: 'top' } /* ... */ }] },
    close: { creatives: [{ src: '/ads/1.jpg', alt: 'Acme ad' }, { src: '/ads/2.jpg', alt: 'Acme ad' }] },
  }}
/>
Web components
<spyglass-creative-card src="/ads/acme-spring.jpg" alt="Acme spring sale ad" fit="cover" position="50% 20%"></spyglass-creative-card>

<spyglass-home-page id="home"></spyglass-home-page>
<script type="module">
  const home = document.getElementById('home')
  home.sections = ['hero', 'stories', 'pricing', 'faq', 'close']
  home.blocks = {
    close: { creatives: [{ src: '/ads/1.jpg', alt: 'Acme ad' }, { src: '/ads/2.jpg', alt: 'Acme ad' }] },
  }
</script>

Sections and pictures by page

Every other page takes sections too (pricing, careers, legal, contact, auth and the rest). An article's own sections stay inside its article, where the first of them falls.

home-page

Sections: hero, proof, features, why, steps, stories, pricing, faq, close

Pictures: blocks: hero, features, why, steps, stories, pricing, close

about-page

Sections: head, photos, story, perks

Pictures: content.photos

blog-page, blog-post-page, changelog-page

Sections: head, featured, posts / head, cover, body, related, offer / head, entries

Pictures: each post's or entry's image

case-studies-page, case-study-page

Sections: head, stories, close / head, facts, cover, lead, body, more, close

Pictures: content.cases[].picture, study.cover

enterprise-page

Sections: hero, proof, run, features, close

Pictures: cards, run, features

templates-page

Sections: wall, run, cities, faq, close

Pictures: blocks.wall.pictures, blocks.run.items, content.cities rows

use-case-page

Sections: hero, proof, story, stories, wheel, faq, close

Pictures: chat, build, blocks.story.story, blocks.wheel.items

product-page

Sections: hero, proof, features, compare, pricing, faq, close

Pictures: features[].data, pricing rows' picture

resources-page, use-cases-page, resource-list-page

Sections: head, cards, close / head, list, close

Pictures: covers' creatives, entries' thumb

Check that none is left

Each placeholder carries data-ds-placeholder, through every shadow root.

Browser console
// Every placeholder carries data-ds-placeholder: none should be left once the pictures are in.
const left = (root = document) => [...root.querySelectorAll('*')].flatMap((el) =>
  [...(el.hasAttribute('data-ds-placeholder') ? [el] : []), ...(el.shadowRoot ? left(el.shadowRoot) : [])])
console.log(left().length)