diff --git a/great_tables/_options.py b/great_tables/_options.py index 7aab82624..5ac5eb98c 100644 --- a/great_tables/_options.py +++ b/great_tables/_options.py @@ -16,6 +16,8 @@ def tab_options( container_height: str | None = None, container_overflow_x: str | None = None, container_overflow_y: str | None = None, + container_padding_x: str | None = None, + container_padding_y: str | None = None, table_width: str | None = None, table_layout: str | None = None, # table_align: str | None = None, @@ -188,6 +190,12 @@ def tab_options( An option to enable scrolling in the vertical direction when the table content overflows. Same rules apply as for `container_overflow_x`; the dependency here is that of the table height (`container_height`). + container_padding_x + The horizontal padding of the table's container. Can be specified as a single-length + character with units of pixels or as a percentage. If provided as a scalar numeric + value, it is assumed that the value is given in units of pixels. + container_padding_y + The vertical padding of the table's container. table_width The width of the table. Can be specified as a string with units of pixels or as a percentage. If provided as a numeric value, it is assumed that the value is given in diff --git a/tests/test_options.py b/tests/test_options.py index 9d274482f..7e47af343 100644 --- a/tests/test_options.py +++ b/tests/test_options.py @@ -65,6 +65,8 @@ def gt_tbl(): container_height="500px", container_overflow_x="hidden", container_overflow_y="hidden", + container_padding_x=css_length_val_small, + container_padding_y=css_length_val_small, table_width=css_length_val_large, table_layout="auto", table_margin_left=css_length_val_margin, @@ -189,6 +191,8 @@ def test_options_all_available(gt_tbl: GT): assert gt_tbl._options.container_height.value == "500px" assert gt_tbl._options.container_overflow_x.value == "hidden" assert gt_tbl._options.container_overflow_y.value == "hidden" + assert gt_tbl._options.container_padding_x.value == css_length_val_small + assert gt_tbl._options.container_padding_y.value == css_length_val_small assert gt_tbl._options.table_width.value == css_length_val_large assert gt_tbl._options.table_layout.value == "auto" assert gt_tbl._options.table_margin_left.value == css_length_val_margin