Basker Docs

Website builder blocks

Read website builder blocks with their settings, resolved data, and children, and the site header, footer, and brand

On a website builder site, the blocks field of a page or other record returns BuilderBlock items. Each block has its settings in props and, for blocks that load content, the loaded data in resolved. site.renderMode is noCode on these sites.

query HomeBuilderBlocks {
  page(path: "/") {
    title
    blocks {
      __typename
      ... on BuilderBlock {
        id
        type
        variant
        anchorId
        props
        resolved
        children {
          type
          variant
          props
        }
      }
    }
  }
}

Block fields

FieldDescription
typeThe block type, for example website-main-hero or website-main-calendar-upcoming.
variantThe variant the editor chose, for example heroWelcome. null for blocks without variants.
id, anchorIdA stable block ID, and the anchor the editor set.
propsThe block settings as JSON. The settings of the selected variant are merged to the top level.
resolvedThe data that Basker loads for the block, or null for blocks that load nothing.
childrenThe nested blocks of a container block.

The website builder block pages describe what each block shows and the options editors set.

Settings in props

props holds the values that editors set in the block. Text settings are strings. Rich text settings hold the editor JSON, for example the title of a hero block:

{
  "blockType": "website-main-hero",
  "variant": "heroWelcome",
  "prefix": "Season 2027",
  "title": {
    "root": {
      "type": "root",
      "children": [
        { "type": "paragraph", "children": [{ "type": "text", "text": "Theatre for everyone" }] }
      ]
    }
  }
}

Render rich text JSON with your own renderer. The node format is the same as the json field of RichText.

Image and media settings hold the media record, with url, alt, width, height, and focalX and focalY, not only its ID.

Data in resolved

Blocks that show other content get it in resolved. Basker loads it with the same rules as a page that it renders:

Blockresolved holds
website-main-calendar-upcominginstances: the performances the block shows.
website-main-calendar-grideventsByMonth, allEvents, venues, and the initial filters.
website-main-collectionentries: the records the block shows, with their media.
website-main-formform: the form definition, and recaptchaSiteKey when the site uses reCAPTCHA.
website-main-hero, website-main-accordion, website-main-faqsorganization: the name of the site.

The shape of resolved is the shape each block component reads, with only public data. Select resolved only for the blocks that need it: it can be large.

Template blocks

A record that a website builder template renders, such as an event, can show blocks from the template around its own blocks. introBlocks returns the blocks before blocks, such as a masthead. outroBlocks returns the blocks after them, such as a list of performances.

query EventTemplateBlocks($slug: String!) {
  event(slug: $slug) {
    introBlocks { type variant props }
    blocks { __typename }
    outroBlocks { type variant resolved }
  }
}

Render the three lists in order. On custom-theme sites, introBlocks and outroBlocks are empty.

Containers

Container blocks, such as website-main-rich-text, hold other blocks. Read them from children. Each child is a BuilderBlock, so you can render the tree with one recursive component.

site.layout returns the header and footer blocks of the default layout, and the brand tokens of the theme. It is null on custom-theme sites.

{
  site {
    renderMode
    layout {
      header { type variant props resolved }
      footer { type variant props resolved }
      brand
    }
  }
}

brand is a JSON object with brand, typography, spacing, and siteColorScheme. Map the values to CSS custom properties in your layout.

On this page