Reusable components

Make any layer a component, give it variants and props, and use it on any page. Edit it once and every copy follows when you publish it; detach a copy when one needs to differ.

Updated · 8 min read

A component is a layer, or a group of layers, that you design once and use on as many pages as you like. Each copy on a page is an instance. Change the component and every instance follows; nothing changes for visitors until you publish it.

Reusable components

Make a component

  1. In the page editor, select the layer to reuse: a card, a button, a row of logos or a whole section.
  2. Press ⌥⌘K (Alt+Ctrl+K on Windows), or right-click it and choose Create component. It's also in the command palette, and on the + beside Components in Insert.
  3. Name it and click Create component.

The layer on the canvas becomes the first instance, looking exactly as it did. It shows the component's colour in Layers, and the panel on the right now shows the component.

Some layers can't be in a component: the header and footer, a split test, members-only content and an overlay's spot. Other components' instances can be, as long as the component's top layer isn't one itself.

Use it on a page

Open Insert. Your components are under Components, each with a live thumbnail and the number of pages it's on. A new site starts with four: the Feature card and the Stat card, which the about page's cards are made of, and Let's talk and Page hero, the closing section and the plain hero most pages share. Change Let's talk once and every page that ends with it changes. A site update keeps them up to date, but leaves one alone if you've changed it, or if you use it on your own pages and the update would drop something your copies set. Drag one onto the canvas, or click it to add it inside the selected layer, as with any block. Search appears once you have seven or more.

Select an instance to see, in the panel on the right:

  • Variant: which version of the component it shows (see below).
  • Props: the settings the component lets each instance change, such as its text, image, link or colour. Leave one empty to show the component's own. A dot marks a prop this instance sets.
  • Overrides: any other setting of a layer inside, changed on this instance only. Click + to add one.
  • Edit component and Detach.
  • Under its name, how many instances it has on how many pages. Click it to see where (see Where it's used below).

Swap one component for another

Click the component's name at the top of the panel and pick another component. The instance keeps what fits the new one: the variant with the same name, the props with the same name and kind, and the overrides of layers the new one has. A message says what didn't fit, with Undo. Only components that go in the same place are listed: sections swap for sections.

Edit a component

Click Edit component on an instance. The component opens on its own canvas, with a bar of its variants across the top. Edit it like any page: what you change shows on every instance. Click Done to go back to the page.

On the right, the component's settings show:

  • Name: rename it here.
  • Props: the props it has. Select a layer inside and click Expose next to a setting to make it a prop; rename a prop here.
  • States: how Hover and Pressed play on a page (see below).
  • Used on: every page with an instance, with a dot for the pages that are live. See all opens Where it's used.
  • Delete: see below.

The component saves as you go, like a page. If someone else is editing it, you'll see who, and their changes aren't overwritten.

Variants

A variant is a named version of a component: Primary and Secondary, or Default and Highlighted. Default is the component as you made it; every other variant is Default plus its own changes.

  • Click Add variant in the bar and name it. While a variant is selected, what you change is saved to that variant, not to Default. A variant changes settings only: add, move, remove, rename or lock layers on Default.
  • Open a variant's menu (the arrow beside its name) to rename, duplicate, move or delete it, or to mark it as a draft. Live pages show Default in place of a draft variant until you tick it when you publish the component.
  • Deleting a variant tells you how many instances show it. They show Default instead.
  • The bar says how many instances show the variant you're on.

When an instance is drawn, the component comes first, then its variant, then the instance's props and overrides.

Components inside components

A component can hold other components: a button inside a card, a card inside a pricing section. Open a component and add another from Insert → Components, or paste one in, as on a page. Edit the inner one once, and it changes everywhere, including inside every component that holds it. Edit component on an instance inside opens that component.

  • A component can't hold itself, or a component that holds it, however many steps away: it would draw inside itself for ever. Insert leaves those out and says how many, Swap doesn't offer them, and dragging or pasting one in is undone with a message. Pasted, such an instance arrives as plain layers.
  • Components go five deep at most, one inside another.
  • A variant changes settings only, so it can't add, detach or swap the components inside. Do that on Default.
  • A component inside another goes live when it's published itself. The outer component's Publish names any inside it that aren't published yet (live, they're left out until they are) or have changes that aren't.

Hover and Pressed

A component can change when someone points at it or presses it: a card that lifts and darkens its title, a button whose arrow slides along.

  • In the component's settings, States → Play chooses how. Whole component plays every layer's Hover or Pressed together while any part of the instance is under the mouse, has keyboard focus inside, or is pressed. Each layer plays a layer's states only while that layer is. New components start as Whole component, unless a layer inside already had its own states.
  • With Whole component, the bar above the canvas has Rest, Hover and Pressed. Pick one and the whole component shows it. Select any layer and change its styles in the Style panel: they're saved to that state. Pick Rest to see it animate back.
  • The animation is each layer's Transition. On a touch screen a tap plays Pressed, and visitors who reduce motion see the colours change without the movement.
  • Each variant can have its own Hover and Pressed styles.

Where it's used

Open it from the instances count under an instance's name, from Shown by in the variants bar, or from See all in the component's settings. It lists every page with an instance, whether the page is live, and each instance in the page's order with its variant. Filter by variant to find, say, every Secondary. Show opens that page with the instance selected, saving your work first. It also lists the components that hold it, and Open takes you to one.

Publish

A component has its own Publish button. It tells you how many live pages it will update and lists them, and which components hold it: wherever they're live, it changes too. Only published changes reach visitors.

When you publish a page that uses a component with unpublished changes, you're asked whether to publish the component too:

  • Publish page and [component] puts both live, so every live page that uses the component changes. Components inside the page's components are asked about too.
  • Page only publishes just the page. Its instances keep showing the component as last published. If the component has never been published, the page leaves it out until it is.

Schedule asks the same question, and does what you chose when the page goes live.

If the component holds a form that isn't published yet, its Publish lets you publish the form with it. If you removed a layer that a prop or a variant changed, those settings wait in the draft (so ⌘Z can bring the layer back) and go when you publish; the publish says how many.

A preview link shows the page as publishing would: components as they are in the editor, but a draft variant as Default.

Every publish of a component is kept as a version. Click the clock in the component's top bar to see them, and Restore one to the component's draft; publish to make it live.

Detach and delete

  • Detach (⌥⌘B, or Alt+Ctrl+B on Windows) turns an instance back into plain layers on that page, looking exactly as it did. It no longer follows the component. ⌘Z undoes it.
  • Detach all and delete, in a component's settings, turns every instance on every page into plain layers, in drafts and on live pages alike, and in split tests, audiences, page templates and the components that hold it too, then deletes the component. It tells you how many instances and pages first, and it can't be undone. It's recorded in Admin → Audit.
  • Anyone with the page open at the time is asked to reload before they save, so the instance isn't put back. An instance of a deleted component that turns up later, in an old version you preview or restore or a page scheduled before the delete, arrives as plain layers looking as the component last did when published.

Copy and paste

Copy an instance and paste it on another page of the same site, or into another component: it stays an instance. Pasted into a site that doesn't have the component, or into a component it holds, it arrives as the plain layers it looked like when you copied it.

Agents

Agents connected through MCP can list your components with list_components and read one with get_component. When they draft a page with import_page, they can place a component as one of its sections, with a variant and prop values. They don't make, change or publish components.

Good to know

  • A site can have up to 200 components. Each can have up to 20 variants and 30 props. Where it's used lists up to 100 instances on each page.
  • Live pages show instances as plain HTML, the same as layers placed by hand: nothing extra loads in visitors' browsers.
  • Only admins can make, change, publish or delete components, as with pages.
  • A page's history keeps its instances by reference, so restoring an old version shows the component as it is now.
  • A translation translates an instance's words in that language only: when you edit the translation, set its text Props, or add an Override for any other words in the component. Translating agents get all of them. The component itself stays the same in every language.
  • In a split test's variant, Edit component opens the component and Back to the variant returns you to the test.

Something unclear or missing? Ask us and we'll answer, then fix the page.

Was this page helpful?

Built with Overlays