1. Install dependencies
Install the InkDes Email package locally and a few components.2. Usage
Rows and columns
Inherit wrapper styles via context
padding
, border
, and borderColor
from Table
flow to Table.Row
and Table.Col
via context.
Override per row or col
Table.Row
can override context for its children; Table.Col
can override for itself.
Using colSpan and width
Table.Col
extends native td
props, so attributes like colSpan
work as expected.
Alignment, vertical alignment, and background
Props
Table
Name | Type | Required | Default | Description | ||||||
---|---|---|---|---|---|---|---|---|---|---|
dir | ”ltr” | “rtl” | No | Comes from wrapping Html component’s dir context prop which is ltr | Text direction | ||||||
spacing | string | No | Comes from wrapping Html component’s defaultSpacing context prop which is 20px | Spacing bottom, by default comes from Html defaultSpacing prop | padding | string | No | "10px" | Inner padding applied to cells via context. | |
border | boolean | No | false | Enables cell borders. | ||||||
borderColor | string | No | "#e5e5e5" | Border color when border is enabled. | ||||||
width | string | No | "100%" | Width of the rendered table. | ||||||
children | React.ReactNode | Yes | — | Typically one or more Table.Row . |
- When
spacing
is provided, an outer wrapper table is used to apply spacing. padding
,border
, andborderColor
are provided to descendants via context and can be overridden byTable.Row
orTable.Col
.- Borders are applied per cell with side-specific rules to avoid double borders (top/left on first row/column; right/bottom on all cells).
Table.Row
Name | Type | Required | Default | Description |
---|---|---|---|---|
dir | ”ltr” | “rtl” | No | ”ltr” | Text direction for the content |
children | React.ReactNode | Yes | — | One or more Table.Col . |
backgroundColor | string | No | — | Background color for the row. |
align | "left" | "center" | "right" | No | "left" | Horizontal text alignment for cells in the row. |
valign | "top" | "middle" | "bottom" | No | "middle" | Vertical alignment for cells in the row. |
padding | string | No | — | Overrides context padding for this row’s cells. |
border | boolean | No | — | Overrides context border for this row’s cells. |
borderColor | string | No | — | Overrides context borderColor for this row’s cells. |
Table.Col
Name | Type | Required | Default | Description |
---|---|---|---|---|
dir | ”ltr” | “rtl” | No | ”ltr” | Text direction for the content |
children | React.ReactNode | Yes | — | Content for the cell. |
backgroundColor | string | No | — | Background color for the cell. |
padding | string | No | — | Padding for the cell (defaults from context if not provided). |
border | boolean | No | — | Whether to set a border on the cell (defaults from context if not provided). |
borderColor | string | No | — | Color for the cell border when border is set (defaults from context if not provided). |
width | string | No | — | Width of the cell. |
align | string | No | — | alignment of cell |
Table.Col
extends nativetd
props, so attributes likecolSpan
androwSpan
are supported.