Skip to content

Padding

For positive values, the Padding element adds empty space around its content.

c#
container
    .Width(250)
    .PaddingVertical(10)
    .PaddingLeft(20)
    .PaddingRight(40)
    .Background(Colors.Grey.Lighten2)
    .Text("Sample text");

example

Negative padding

For negative values, it pushes content beyond the edges, increasing available space (similar to negative HTML margins).

c#
container
    .Width(250)
    .Padding(50)
    .Background(Colors.Grey.Lighten2)
    .PaddingHorizontal(-25)
    .Text("Sample text with negative padding");

example

API

MethodDescription
PaddingAdds empty space around its content.
PaddingHorizontalAdds empty space horizontally (left and right) around its content.
PaddingVerticalAdds empty space vertically (top and bottom) around its content.
PaddingTopAdds empty space above its content.
PaddingBottomAdds empty space below its content.
PaddingLeftAdds empty space to the left of its content.
PaddingRightAdds empty space to the right of its content.

Released under the MIT License