summaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/typst-library/src/layout/table.rs25
1 files changed, 22 insertions, 3 deletions
diff --git a/crates/typst-library/src/layout/table.rs b/crates/typst-library/src/layout/table.rs
index 1b84a616..056b63a2 100644
--- a/crates/typst-library/src/layout/table.rs
+++ b/crates/typst-library/src/layout/table.rs
@@ -114,8 +114,27 @@ pub struct TableElem {
pub stroke: Option<Stroke>,
/// How much to pad the cells' content.
- #[default(Abs::pt(5.0).into())]
- pub inset: Rel<Length>,
+ ///
+ /// ```example
+ /// #table(
+ /// inset: 10pt,
+ /// [Hello],
+ /// [World],
+ /// )
+ ///
+ /// #table(
+ /// columns: 2,
+ /// inset: (
+ /// x: 20pt,
+ /// y: 10pt,
+ /// ),
+ /// [Hello],
+ /// [World],
+ /// )
+ /// ```
+ #[fold]
+ #[default(Sides::splat(Abs::pt(5.0).into()))]
+ pub inset: Sides<Option<Rel<Length>>>,
/// The contents of the table cells.
#[variadic]
@@ -141,7 +160,7 @@ impl Layout for TableElem {
.into_iter()
.enumerate()
.map(|(i, child)| {
- let mut child = child.padded(Sides::splat(inset));
+ let mut child = child.padded(inset);
let x = i % cols;
let y = i / cols;