Optionaloptions: number | ObjectOptions for creating the table. Provide a number to set table_width directly, or an options object.
Whether the table has a column header.
Whether the table has a row header.
An array of rows. Each row can be an array (strings/numbers/rich-text objects) or a table_row block.
Explicit table width. When rows are supplied, the first row's cell count is used instead.
A table block object compatible with Notion's API.
// Use with array of string arrays
const simpleTable = block.table.createBlock({
rows: [
["Header 1", "Header 2"],
["Row 1, Cell 1", "Row 1, Cell 2"],
["Row 2, Cell 1", "Row 2, Cell 2"]
],
has_column_header: true
});
// Use with array of table_row objects
const complexTable = block.table.createBlock({
rows: [
block.table_row.createBlock(["Header 1", "Header 2"]),
block.table_row.createBlock(["Row 1, Cell 1", "Row 1, Cell 2"]),
block.table_row.createBlock(["Row 2, Cell 1", "Row 2, Cell 2"])
],
has_column_header: true,
has_row_header: false
});
Creates a table block.