padding
Add space around view content.
padding() uses SwiftUI's system default inset. padding(value) accepts a finite number or an edge object. Values use pt and may be negative.
type Padding = number | {
readonly top?: number
readonly leading?: number
readonly bottom?: number
readonly trailing?: number
readonly horizontal?: number
readonly vertical?: number
}A number applies the same padding to every edge.
<Text modifier={Modifier.padding()}>System inset</Text>
<Text modifier={Modifier.padding(12)}>Hello</Text>
<Text modifier={Modifier.padding(-4)}>Negative inset</Text>In an edge object, horizontal supplies the default for leading and trailing, while vertical supplies the default for top and bottom. A specific edge overrides its corresponding axis value.
<Text
modifier={Modifier.padding({
horizontal: 12,
vertical: 8,
leading: 16,
bottom: 10
})}
>
Hello
</Text>This example resolves to top: 8, leading: 16, bottom: 10, and trailing: 12. Unsupported keys and non-finite values throw an error.
How is this guide?
Last updated on