---
title: "BlockSpec"
version: "0.9.0"
url: "https://docs.laminapdf.com/reference/sdk/type-aliases/blockspec/"
---

# BlockSpec

```ts
type BlockSpec = 
  | {
  align?: AlignSpec | null;
  breakBefore?: boolean;
  keepWithNext?: boolean;
  level?: number | null;
  lineHeight?: number | null;
  orphans?: number | null;
  spaceAfter?: number | null;
  spaceBefore?: number | null;
  spans?: SpanSpec[] | null;
  style?: string | null;
  text?: Text | null;
  type: "paragraph";
  widows?: number | null;
}
  | {
  align?: AlignSpec | null;
  breakBefore?: boolean;
  keepWithNext?: boolean;
  level?: number | null;
  lineHeight?: number | null;
  orphans?: number | null;
  spaceAfter?: number | null;
  spaceBefore?: number | null;
  spans?: SpanSpec[] | null;
  style?: string | null;
  text?: Text | null;
  type: "heading";
  widows?: number | null;
}
  | {
  indent?: number | null;
  items: ListItemSpec[];
  kind: ListKindSpec;
  start?: number | null;
  style?: string | null;
  type: "list";
}
  | {
  alt: Text;
  image: string;
  type: "figure";
  width?: number | null;
}
  | {
  height: number;
  type: "spacer";
}
  | {
  type: "pageBreak";
}
  | {
  blocks: BlockSpec[];
  type: "keep";
}
  | {
  columns: ColumnSpec[];
  footer?: RowSpec[];
  frame?: RuleSpec | null;
  header?: RowSpec[];
  headerBackground?: string | null;
  headerRule?: RuleSpec | null;
  padding?: number | null;
  rowRules?: RuleSpec | null;
  rows?: RowSpec[];
  spaceAfter?: number | null;
  spaceBefore?: number | null;
  type: "table";
}
  | {
  indent?: number | null;
  levels?: number | null;
  style?: string | null;
  type: "contents";
}
  | {
  blocks: BlockSpec[];
  type: "quote";
}
  | {
  style?: string | null;
  text: Text;
  type: "codeBlock";
}
  | {
  type: "rule";
};
```

Defined in: [packages/sdk/src/generated/document.ts:16](https://github.com/laudebugs/laminapdf/blob/v0.9.0/packages/sdk/src/generated/document.ts#L16)

One block of the flow, tagged by `type`.

## Union Members

### Type Literal

```ts
{
  align?: AlignSpec | null;
  breakBefore?: boolean;
  keepWithNext?: boolean;
  level?: number | null;
  lineHeight?: number | null;
  orphans?: number | null;
  spaceAfter?: number | null;
  spaceBefore?: number | null;
  spans?: SpanSpec[] | null;
  style?: string | null;
  text?: Text | null;
  type: "paragraph";
  widows?: number | null;
}
```

#### align?

```ts
align?: AlignSpec | null;
```

Where the lines sit.

#### breakBefore?

```ts
breakBefore?: boolean;
```

Start it on a new page.

#### keepWithNext?

```ts
keepWithNext?: boolean;
```

Keep it on the page of the next block.

#### level?

```ts
level?: number | null;
```

The heading's level, 1 to 6: needed by a heading, refused on a paragraph.

#### lineHeight?

```ts
lineHeight?: number | null;
```

The space between lines, as a factor of the size (1.2 when left out).

#### orphans?

```ts
orphans?: number | null;
```

The fewest lines of the paragraph left at the foot of a page before it breaks (2 when
left out).

#### spaceAfter?

```ts
spaceAfter?: number | null;
```

Points of space below.

#### spaceBefore?

```ts
spaceBefore?: number | null;
```

Points of space above.

#### spans?

```ts
spans?: SpanSpec[] | null;
```

The text as spans; give this or `text`.

#### style?

```ts
style?: string | null;
```

The style of `text`, and of spans that name none (`body` when left out).

#### text?

```ts
text?: Text | null;
```

The text, in `style`; give this or `spans`.

#### type

```ts
type: "paragraph";
```

#### widows?

```ts
widows?: number | null;
```

The fewest lines of the paragraph carried to the top of a new page (2 when left out).

***

### Type Literal

```ts
{
  align?: AlignSpec | null;
  breakBefore?: boolean;
  keepWithNext?: boolean;
  level?: number | null;
  lineHeight?: number | null;
  orphans?: number | null;
  spaceAfter?: number | null;
  spaceBefore?: number | null;
  spans?: SpanSpec[] | null;
  style?: string | null;
  text?: Text | null;
  type: "heading";
  widows?: number | null;
}
```

#### align?

```ts
align?: AlignSpec | null;
```

Where the lines sit.

#### breakBefore?

```ts
breakBefore?: boolean;
```

Start it on a new page.

#### keepWithNext?

```ts
keepWithNext?: boolean;
```

Keep it on the page of the next block.

#### level?

```ts
level?: number | null;
```

The heading's level, 1 to 6: needed by a heading, refused on a paragraph.

#### lineHeight?

```ts
lineHeight?: number | null;
```

The space between lines, as a factor of the size (1.2 when left out).

#### orphans?

```ts
orphans?: number | null;
```

The fewest lines of the paragraph left at the foot of a page before it breaks (2 when
left out).

#### spaceAfter?

```ts
spaceAfter?: number | null;
```

Points of space below.

#### spaceBefore?

```ts
spaceBefore?: number | null;
```

Points of space above.

#### spans?

```ts
spans?: SpanSpec[] | null;
```

The text as spans; give this or `text`.

#### style?

```ts
style?: string | null;
```

The style of `text`, and of spans that name none (`body` when left out).

#### text?

```ts
text?: Text | null;
```

The text, in `style`; give this or `spans`.

#### type

```ts
type: "heading";
```

#### widows?

```ts
widows?: number | null;
```

The fewest lines of the paragraph carried to the top of a new page (2 when left out).

***

### Type Literal

```ts
{
  indent?: number | null;
  items: ListItemSpec[];
  kind: ListKindSpec;
  start?: number | null;
  style?: string | null;
  type: "list";
}
```

#### indent?

```ts
indent?: number | null;
```

Points the items are indented.

#### items

```ts
items: ListItemSpec[];
```

The items.

#### kind

```ts
kind: ListKindSpec;
```

`bullet` or `numbered`.

#### start?

```ts
start?: number | null;
```

The first number of a numbered list (1 when left out).

#### style?

```ts
style?: string | null;
```

The markers' style (`body` when left out).

#### type

```ts
type: "list";
```

***

### Type Literal

```ts
{
  alt: Text;
  image: string;
  type: "figure";
  width?: number | null;
}
```

#### alt

```ts
alt: Text;
```

Its alternate text, which a screen reader reads.

#### image

```ts
image: string;
```

An image given beside the document, by name.

#### type

```ts
type: "figure";
```

#### width?

```ts
width?: number | null;
```

Its width in points (the body's width at most; its own size when left out).

***

### Type Literal

```ts
{
  height: number;
  type: "spacer";
}
```

#### height

```ts
height: number;
```

Its height in points.

#### type

```ts
type: "spacer";
```

***

### Type Literal

```ts
{
  type: "pageBreak";
}
```

***

### Type Literal

```ts
{
  blocks: BlockSpec[];
  type: "keep";
}
```

#### blocks

```ts
blocks: BlockSpec[];
```

The blocks.

#### type

```ts
type: "keep";
```

***

### Type Literal

```ts
{
  columns: ColumnSpec[];
  footer?: RowSpec[];
  frame?: RuleSpec | null;
  header?: RowSpec[];
  headerBackground?: string | null;
  headerRule?: RuleSpec | null;
  padding?: number | null;
  rowRules?: RuleSpec | null;
  rows?: RowSpec[];
  spaceAfter?: number | null;
  spaceBefore?: number | null;
  type: "table";
}
```

#### columns

```ts
columns: ColumnSpec[];
```

One width per column.

#### footer?

```ts
footer?: RowSpec[];
```

The footer rows, kept with the last body row.

#### frame?

```ts
frame?: RuleSpec | null;
```

A rule around the table.

#### header?

```ts
header?: RowSpec[];
```

The header rows, repeated on each page the table runs onto.

#### headerBackground?

```ts
headerBackground?: string | null;
```

The header rows' background, as `#rrggbb`.

#### headerRule?

```ts
headerRule?: RuleSpec | null;
```

A rule under the header.

#### padding?

```ts
padding?: number | null;
```

Points of space inside each cell.

#### rowRules?

```ts
rowRules?: RuleSpec | null;
```

A rule between body rows.

#### rows?

```ts
rows?: RowSpec[];
```

The body rows; a row is never split between pages.

#### spaceAfter?

```ts
spaceAfter?: number | null;
```

Points of space below the table.

#### spaceBefore?

```ts
spaceBefore?: number | null;
```

Points of space above the table.

#### type

```ts
type: "table";
```

***

### Type Literal

```ts
{
  indent?: number | null;
  levels?: number | null;
  style?: string | null;
  type: "contents";
}
```

#### indent?

```ts
indent?: number | null;
```

Points each level below the first is indented.

#### levels?

```ts
levels?: number | null;
```

The deepest heading level it lists, 1 to 6 (2 when left out).

#### style?

```ts
style?: string | null;
```

The entries' style (`body` when left out).

#### type

```ts
type: "contents";
```

***

### Type Literal

```ts
{
  blocks: BlockSpec[];
  type: "quote";
}
```

#### blocks

```ts
blocks: BlockSpec[];
```

The blocks.

#### type

```ts
type: "quote";
```

***

### Type Literal

```ts
{
  style?: string | null;
  text: Text;
  type: "codeBlock";
}
```

#### style?

```ts
style?: string | null;
```

Its style (`body` when left out).

#### text

```ts
text: Text;
```

The code.

#### type

```ts
type: "codeBlock";
```

***

### Type Literal

```ts
{
  type: "rule";
}
```

## Since

0.2.0
