Polotno Docs

TableElement

Table element. Extends ShapeAttributes but shadow, blur, brightness, sepia, grayscale, and filter properties are stripped from serialized output.

TableElement

Table element. Extends ShapeAttributes but shadow, blur, brightness, sepia, grayscale, and filter properties are stripped from serialized output.

Type Information

Base Type: object

Properties

PropertyTypeDescription
alignstringDefault text alignment for cell text: 'left', 'center', 'right', 'justify'.
alwaysOnTopbooleanWhether element stays on top of others.
animationsArray<Animation>Animation configurations.
borderColorstringDefault border color for all cell borders.
borderStyle"solid" | "dashed" | "dotted" | "none"Default border line style for all cell borders.
borderWidthnumberDefault border width in pixels for all cell borders.
cellBackgroundstringDefault cell background color.
cellPaddingnumberDefault cell inner padding in pixels.
cellsArray<TableCell>Flat array of cells in row-major order (length = rows * cols).
colWidthsArray<number>Column width fractions (sum to 1). Each value represents the fraction of total table width for that column.
colsnumberNumber of columns.
contentEditablebooleanWhether element content can be edited.
customunknownCustom data attached to the element.
draggablebooleanWhether element can be dragged.
fillstringDefault text color for cell text.
fontFamilystringDefault font family for cell text.
fontSizenumberDefault font size in pixels for cell text.
fontStylestringDefault font style for cell text: 'normal' or 'italic'.
fontWeightstringDefault font weight for cell text: 'normal', 'bold', or numeric string.
heightnumberHeight in pixels.
idstringUnique identifier for the element.
letterSpacingnumberDefault letter spacing for cell text as percentage of font size.
lineHeightnumber | stringDefault line height for cell text.
namestringDisplay name for the element.
opacitynumberOpacity level (0-1).
resizablebooleanWhether element can be resized.
rotationnumberRotation angle in degrees.
rowHeightsArray<number>Row height fractions (sum to 1). Each value represents the fraction of total table height for that row.
rowsnumberNumber of rows.
selectablebooleanWhether element can be selected.
showInExportbooleanWhether element appears in exports.
strokestringDefault text stroke color for cell text.
strokeWidthnumberDefault text stroke width in pixels for cell text.
styleEditablebooleanWhether element style can be edited.
textDecorationstringDefault text decoration for cell text.
textTransformstringDefault text transform for cell text: 'uppercase', 'lowercase', 'capitalize', 'none'.
type"table"Element type identifier.
verticalAlignstringDefault vertical alignment for cell text: 'top', 'middle', 'bottom'.
visiblebooleanWhether element is visible.
widthnumberWidth in pixels.
xnumberX position in pixels.
ynumberY position in pixels.

JSON Schema

{
  "additionalProperties": false,
  "description": "Table element. Extends ShapeAttributes but shadow, blur, brightness, sepia, grayscale, and filter properties are stripped from serialized output.",
  "properties": {
    "align": {
      "description": "Default text alignment for cell text: 'left', 'center', 'right', 'justify'.",
      "type": "string"
    },
    "alwaysOnTop": {
      "description": "Whether element stays on top of others.",
      "type": "boolean"
    },
    "animations": {
      "description": "Animation configurations.",
      "items": {
        "$ref": "#/definitions/Animation"
      },
      "type": "array"
    },
    "borderColor": {
      "description": "Default border color for all cell borders.",
      "type": "string"
    },
    "borderStyle": {
      "description": "Default border line style for all cell borders.",
      "enum": [
        "solid",
        "dashed",
        "dotted",
        "none"
      ],
      "type": "string"
    },
    "borderWidth": {
      "description": "Default border width in pixels for all cell borders.",
      "type": "number"
    },
    "cellBackground": {
      "description": "Default cell background color.",
      "type": "string"
    },
    "cellPadding": {
      "description": "Default cell inner padding in pixels.",
      "type": "number"
    },
    "cells": {
      "description": "Flat array of cells in row-major order (length = rows * cols).",
      "items": {
        "$ref": "#/definitions/TableCell"
      },
      "type": "array"
    },
    "colWidths": {
      "description": "Column width fractions (sum to 1). Each value represents the fraction of total table width for that column.",
      "items": {
        "type": "number"
      },
      "type": "array"
    },
    "cols": {
      "description": "Number of columns.",
      "type": "number"
    },
    "contentEditable": {
      "description": "Whether element content can be edited.",
      "type": "boolean"
    },
    "custom": {
      "description": "Custom data attached to the element."
    },
    "draggable": {
      "description": "Whether element can be dragged.",
      "type": "boolean"
    },
    "fill": {
      "description": "Default text color for cell text.",
      "type": "string"
    },
    "fontFamily": {
      "description": "Default font family for cell text.",
      "type": "string"
    },
    "fontSize": {
      "description": "Default font size in pixels for cell text.",
      "type": "number"
    },
    "fontStyle": {
      "description": "Default font style for cell text: 'normal' or 'italic'.",
      "type": "string"
    },
    "fontWeight": {
      "description": "Default font weight for cell text: 'normal', 'bold', or numeric string.",
      "type": "string"
    },
    "height": {
      "description": "Height in pixels.",
      "type": "number"
    },
    "id": {
      "description": "Unique identifier for the element.",
      "type": "string"
    },
    "letterSpacing": {
      "description": "Default letter spacing for cell text as percentage of font size.",
      "type": "number"
    },
    "lineHeight": {
      "description": "Default line height for cell text.",
      "type": [
        "number",
        "string"
      ]
    },
    "name": {
      "description": "Display name for the element.",
      "type": "string"
    },
    "opacity": {
      "description": "Opacity level (0-1).",
      "type": "number"
    },
    "resizable": {
      "description": "Whether element can be resized.",
      "type": "boolean"
    },
    "rotation": {
      "description": "Rotation angle in degrees.",
      "type": "number"
    },
    "rowHeights": {
      "description": "Row height fractions (sum to 1). Each value represents the fraction of total table height for that row.",
      "items": {
        "type": "number"
      },
      "type": "array"
    },
    "rows": {
      "description": "Number of rows.",
      "type": "number"
    },
    "selectable": {
      "description": "Whether element can be selected.",
      "type": "boolean"
    },
    "showInExport": {
      "description": "Whether element appears in exports.",
      "type": "boolean"
    },
    "stroke": {
      "description": "Default text stroke color for cell text.",
      "type": "string"
    },
    "strokeWidth": {
      "description": "Default text stroke width in pixels for cell text.",
      "type": "number"
    },
    "styleEditable": {
      "description": "Whether element style can be edited.",
      "type": "boolean"
    },
    "textDecoration": {
      "description": "Default text decoration for cell text.",
      "type": "string"
    },
    "textTransform": {
      "description": "Default text transform for cell text: 'uppercase', 'lowercase', 'capitalize', 'none'.",
      "type": "string"
    },
    "type": {
      "const": "table",
      "description": "Element type identifier.",
      "type": "string"
    },
    "verticalAlign": {
      "description": "Default vertical alignment for cell text: 'top', 'middle', 'bottom'.",
      "type": "string"
    },
    "visible": {
      "description": "Whether element is visible.",
      "type": "boolean"
    },
    "width": {
      "description": "Width in pixels.",
      "type": "number"
    },
    "x": {
      "description": "X position in pixels.",
      "type": "number"
    },
    "y": {
      "description": "Y position in pixels.",
      "type": "number"
    }
  },
  "required": [
    "align",
    "alwaysOnTop",
    "animations",
    "borderColor",
    "borderStyle",
    "borderWidth",
    "cellBackground",
    "cellPadding",
    "cells",
    "colWidths",
    "cols",
    "contentEditable",
    "draggable",
    "fill",
    "fontFamily",
    "fontSize",
    "fontStyle",
    "fontWeight",
    "height",
    "id",
    "letterSpacing",
    "lineHeight",
    "opacity",
    "resizable",
    "rotation",
    "rowHeights",
    "rows",
    "selectable",
    "showInExport",
    "stroke",
    "strokeWidth",
    "styleEditable",
    "textDecoration",
    "textTransform",
    "type",
    "verticalAlign",
    "visible",
    "width",
    "x",
    "y"
  ],
  "type": "object"
}

On this page