# Blocks (https://divplate.com/docs/blocks)



Every section block is a `Section` with a `Container` inside:

```tsx
<Section>
  <Container>{/* the block's content */}</Container>
</Section>
```

| Part        | Handles                                          |
| ----------- | ------------------------------------------------ |
| `Section`   | Space above and below, background, light or dark |
| `Container` | Content width and the side margins               |

Blocks have no padding of their own, which is why they space evenly when you
stack them. Components, such as headings, badges, cards and FAQ items, go
inside a section.

## Four settings [#four-settings]

| Setting    | Set with       | More in                               |
| ---------- | -------------- | ------------------------------------- |
| Spacing    | `spacing`      | [Layout](https://divplate.com/docs/layout)                |
| Grid lines | `data-rails`   | [Layout](https://divplate.com/docs/layout#grid-lines)     |
| Light/dark | `scheme`       | [Colors](https://divplate.com/docs/colors#light-and-dark) |
| Palette    | `data-palette` | [Colors](https://divplate.com/docs/colors#palettes)       |

Spacing and light or dark go through the `section` prop, so you never have to
edit the block:

```tsx
<Hero04 section={{ spacing: "viewport", scheme: "dark" }} />
```

Grid lines and palettes go on the element around your page, so every block
picks them up.

## The HTML element [#the-html-element]

A block renders a `<section>`. Navbars render a `<header>` and footers a
`<footer>`. To use another one:

```tsx
<Hero04 section={{ as: "aside" }} />
```

You can pass `section`, `footer`, `header` or `aside`.

<Callout title="Two different as props">
  `section={{ as: … }}` sets the **element**. A block's own `as={…}`, below,
  sets the **heading level**.
</Callout>

## Headings [#headings]

Every block with a headline takes `as`, and it defaults to `h1`:

```tsx
<Hero04 />            {/* h1 */}
<NextBlock as="h2" /> {/* h2 for every block after the first */}
```

A page should have one `h1`, so pass `as="h2"` to every block after the first.
The headings inside a block adjust on their own.

## Media [#media]

The screenshot in a preview is a placeholder, so a block installs with an empty
frame. Pass your own image, video or component to `media`:

```tsx
<Hero04 media={<img src="/product.png" alt="" />} />
```

### Art behind the band [#art]

Hero 40 to 57 put the screenshot on a band of color. Pass `art` to show an
image or gradient on that band:

```tsx
<Hero40
  media={<img src="/product.png" alt="" />}
  art={<img src="/band.jpg" alt="" />}
/>
```

Make it 1920px wide. The last 160px on each side fade into the band's color.

## Editing a block [#editing-a-block]

It is your file, so change anything. Two tips:

* **Keep `Section` and `Container`.** Add padding to a block and it stops
  lining up with the others.
* **Use tokens.** If you need a new value, add a token instead of a number in
  one block.
