Concrete
GuidesDeclare slots

Add video, tour and document slots

The property has a walkthrough clip, a 3D tour or a brochure, and you need to know which kind holds which.

Goal

A section that plays the property's video, embeds its 3D tour and offers its brochure for download — three kinds, each configured by what it actually is.

Prerequisites

  • The workspace Start leaves you with, and concrete dev running.
  • Slots for the value each kind binds at render.

Steps

1. Pick the kind by the asset, not by the markup

These are three kinds rather than one "media" kind because their candidates and their options do not overlap:

  • video is a clip the platform hosts or a provider link — YouTube, Vimeo — alike. It is the only one of the three that configures playback.
  • tour is a provider walkthrough — a Matterport or the like — embedded in an iframe. It has no type-specific option at all.
  • document is a file the visitor opens or downloads: a pdf, a spreadsheet, an office file. It is served as uploaded, so it configures nothing either.

What the three share is where the value comes from: the list the slot names in from, of the slot's kind — fact.property.property_media for the property's videos and tours, fact.property.uploads for everything it holds, its documents among them. A filled slot is bound to no fact, so those candidates are what the model chooses from and what the user is offered.

2. Declare the video and how it plays

sections/media.tsx
import { fact, fill, video } from "@homepages/concrete";

const clip = video({
  label: "Property video",
  from: fact.property.property_media,
  playback: { autoplay: true, muted: true, loop: true, playsinline: true, preload: "none" },
  source: fill.pick({ brief: "The full walkthrough, not a single-room clip." }),
});

Whether a pasted link may fill the slot is nothing you declare: a link's kind is its provider's, so every video slot takes an uploaded clip or a provider link, and a link honours playback as far as its player allows. A sources key is contract/sources.

Always pass muted beside autoplay. Every browser refuses unmuted autoplay, so an autoplaying clip without it is silence a visitor has to click — check time is what enforces it.

3. Declare the tour, which configures nothing

sections/media.tsx
import { fact, fill, tour } from "@homepages/concrete";

const walkthrough = tour({
  label: "3D tour",
  from: fact.property.property_media,
  source: fill.pick({ brief: "The whole-home walkthrough, not a single-room scan." }),
});

No crop (a tour is selected, never edited), no playback (an iframe embed honours none), no accepts (which providers are admitted widens in the platform's link catalog, never on your slot). One selection renders three ways, and you may use more than one: the embed with Slot.Tour, the tour's own thumbnail with Slot.Image, or both.

4. Declare the document, which must be filled

sections/media.tsx
import { document, fact, fill } from "@homepages/concrete";

const brochure = document({
  label: "Offering brochure",
  from: fact.property.uploads,
  source: fill.pick({
    brief: "The offering brochure — a multi-page PDF about the whole property, not a single-unit floor plan.",
  }),
});

No catalog field holds a document, so there is no source to bind and the fill is the only origin: a document slot with no source: is refused. Write the brief against what the model can actually see of a candidate — its filename, its file type, and whatever text was distilled out of it. A spreadsheet or a slide deck yields none, so name the file type when it matters.

When the file lives somewhere the platform neither stores nor serves — a Drive or Dropbox link — reach for url({ accepts: "file" }) instead. A link kind with no provider behind it is contract/url.

A document also renders three ways: a link to the file with Slot.Download, a PDF embedded in place with Slot.Document, and its first page as a still with Slot.Image. The viewer and the still are for a PDF — any other file renders the empty box in both, so a slot that may hold a spreadsheet keeps a Slot.Download.

5. Render them

sections/media.tsx
import {
  document,
  fact,
  fill,
  Section,
  section,
  Slot,
  tour,
  video,
} from "@homepages/concrete";

export const Media = section(
  {
    key: "media",
    label: "Media",
    slots: {
      clip: video({
        label: "Property video",
        from: fact.property.property_media,
        playback: { controls: true },
        source: fill.pick({ brief: "The full walkthrough." }),
      }),
      walkthrough: tour({ label: "3D tour", from: fact.property.property_media, source: fill.pick({ brief: "The whole-home walkthrough." }) }),
      brochure: document({
        label: "Offering brochure",
        from: fact.property.uploads,
        source: fill.pick({ brief: "The full brochure." }),
      }),
    },
  },
  ({ slot }) => (
    <Section>
      <Slot.Video slot={slot.clip} className="aspect-video w-full" />
      <Slot.Tour slot={slot.walkthrough} className="aspect-video w-full" />
      <Slot.Download slot={slot.brochure}>Download the brochure</Slot.Download>
    </Section>
  ),
);

Slot.Video and Slot.Tour render their engine's own box, so the frame is your classes. Slot.Download is one anchor and defaults its element to <a>. Each slot needs at least one rendering, or render/missing-slot-marker fires.

6. Reach for a list when the property has several

A list of any of the three is a pick of a set from the property's media. The pick chooses from its item's candidates, as on a single slot — the property's videos, tours or documents — and the list holds no file twice. A filled list is bound to no fact, so its item's kind and from say what the model and the user pick from:

sections/media.tsx
import { document, fact, fill, list } from "@homepages/concrete";

const disclosures = list({
  label: "Disclosures",
  min: 1,
  max: 8,
  source: fill.pick({ brief: "Every disclosure document." }),
  item: document({ from: fact.property.uploads }),
});

A filled list declares max, and a list missing it is contract/fill-verb; a picked list whose item holds no candidates is refused when the section is declared. A from that names no media list of the property, or one on a media slot bound to a fact, is contract/sources.

Verify

Run concrete dev over a fixture whose property carries all three. The clip plays in its box, the tour embeds, and the brochure link opens the file. A fixture media entry the property does not carry surfaces as render/unresolved-media rather than a broken frame.

Then run concrete check:

concrete check
concrete check passed: 13 stages.

On this page