<aside> 👉

Links (Block base class)

Page

AudioBlock

Block

CalloutBlock

DividerBlock

Heading1Block

ImageBlock

ParagraphBlock

TableBlock

ToggleHeading4Block

Database

BookmarkBlock

CodeBlock

EmbedBlock

Heading2Block

LinkPreviewBlock

PdfBlock

ToDoBlock

TableRowBlock

ToggleHeading2Block

DataSource 🆕

BreadcrumbBlock

ColumnBlock

EquationBlock

Heading3Block

LinkToPageBlock

QuoteBlock

ToggleBlock

TableOfContentsBlock

VideoBlock

List

BulletedListItemBlock

ColumnListBlock

FileBlock

Heading4Block

NumberedListItemBlock

SyncedBlock

ToggleHeading1Block

ToggleHeading3Block

Notion Ruby Mapping Public API Reference

</aside>

1. Class methods

self.new(table_width: nil, has_column_header: false, has_row_header: false, table_rows: nil) → TableBlock

Creates a TableBlock. A new table contains one or more TableRowBlock children and has a fixed number of columns.

table = TableBlock.new(
  has_column_header: true,
  table_rows: [
    %w[Name Score],
    ["Alice", "90"],
  ],
)

<aside> ⚠️

A new table must contain at least one non-empty row. Every row must contain exactly table_width cells. A table retrieved from Notion does not include its rows in the table block response; retrieve them separately through children.

</aside>

2. Instance methods

table_width → Integer

Returns the fixed number of columns. The value is inferred from the first row when it is omitted while building a new table. table_width cannot be changed after creation.

has_column_header → Boolean

Returns whether the first row is treated as a column header.

has_column_header=(flag)

Changes the column-header setting and marks it for the next block update.