diff --git a/crates/typst/src/layout/container.rs b/crates/typst/src/layout/container.rs index 83523861a..443e660ab 100644 --- a/crates/typst/src/layout/container.rs +++ b/crates/typst/src/layout/container.rs @@ -106,6 +106,18 @@ pub struct BoxElem { pub outset: Sides>>, /// Whether to clip the content inside the box. + /// + /// Clipping is useful when the box's content is larger than the box itself, + /// as any content that exceeds the box's bounds will be hidden. + /// + /// ```example + /// #box( + /// width: 50pt, + /// height: 50pt, + /// clip: true, + /// image("tiger.jpg", width: 100pt, height: 100pt) + /// ) + /// ``` #[default(false)] pub clip: bool, @@ -422,6 +434,18 @@ pub struct BlockElem { pub below: Smart, /// Whether to clip the content inside the block. + /// + /// Clipping is useful when the block's content is larger than the box itself, + /// as any content that exceeds the box's bounds will be hidden. + /// + /// ```example + /// #block( + /// width: 50pt, + /// height: 50pt, + /// clip: true, + /// image("tiger.jpg", width: 100pt, height: 100pt) + /// ) + /// ``` #[default(false)] pub clip: bool,