diff --git a/plugins/ui/docs/components/table.md b/plugins/ui/docs/components/table.md index 2d11d5830..f44d6ec2c 100644 --- a/plugins/ui/docs/components/table.md +++ b/plugins/ui/docs/components/table.md @@ -172,6 +172,24 @@ t = ui.table( ) ``` +### Formatting cell text alignment + +You can control text alignment using the `alignment` property. This property accepts the values `left`, `center`, and `right`, overriding the default alignment based on the column type. By default, numeric columns are right-aligned, string columns are left-aligned, and date columns are center-aligned. + +```python +from deephaven import ui +import deephaven.plot.express as dx + +t = ui.table( + dx.data.stocks(), + format_=[ + ui.TableFormat(cols="Sym", alignment="right"), + ui.TableFormat(cols="Exchange", alignment="center"), + ui.TableFormat(cols="Size", alignment="left"), + ], +) +``` + ## Aggregations You can add aggregation rows to the table using `ui.TableAgg` with the `aggregations` prop. These will be shown as floating rows at the top or bottom of the table and account for any user-applied filters. The `aggregations_position` prop determines if aggregations are shown at the top or bottom of the table and defaults to the bottom. The full list of aggregations can be found in the "Aggregate Columns" section in the table sidebar menu and in our [JavaScript API docs](/core/client-api/javascript/classes/dh.AggregationOperation.html). diff --git a/plugins/ui/docs/snapshots/d6058276014693898f04ab2b12370116.json b/plugins/ui/docs/snapshots/d6058276014693898f04ab2b12370116.json new file mode 100644 index 000000000..c0e79c01f --- /dev/null +++ b/plugins/ui/docs/snapshots/d6058276014693898f04ab2b12370116.json @@ -0,0 +1 @@ +{"file":"components/table.md","objects":{"t":{"type":"deephaven.ui.Element","data":{"document":{"__dhElemName":"deephaven.ui.elements.UITable","props":{"table":{"__dhObid":0},"format_":[{"cols":"Sym","alignment":"right"},{"cols":"Exchange","alignment":"center"},{"cols":"Size","alignment":"left"}],"showQuickFilters":false,"showGroupingColumn":true,"showSearch":false,"reverse":false}},"state":"{}"}}}} \ No newline at end of file