--- title: Spacing description: JSX style props for controlling the padding and margin of an element. --- ## Padding ### All sides Use the `padding` prop to apply padding on all sides of an element ```jsx // raw value // shorthand // token value // shorthand ``` | Prop | CSS Property | Token Category | | ------------- | ------------ | -------------- | | `p`,`padding` | `padding` | `spacing` | ### Specific side Use the `padding{Left,Right,Top,Bottom}` to apply padding on one side of an element ```jsx // shorthand // shorthand ``` Use the `padding{Start,End}` props to apply padding on the logical axis of an element based on the text direction. ```jsx
// shorthand
// shorthand ``` | Prop | CSS Property | Token Category | | --------------------- | ---------------------- | -------------- | | `pl`, `paddingLeft` | `padding-left` | `spacing` | | `pr`, `paddingRight` | `padding-right` | `spacing` | | `pt`, `paddingTop` | `padding-top` | `spacing` | | `pb`, `paddingBottom` | `padding-bottom` | `spacing` | | `ps`, `paddingStart` | `padding-inline-start` | `spacing` | | `pe`, `paddingEnd` | `padding-inline-end` | `spacing` | ### Horizontal and Vertical padding Use the `padding{X,Y}` props to apply padding on the horizontal and vertical axis of an element ```jsx // shorthand // shorthand ``` | Prop | CSS Property | Token Category | | --------------------- | ---------------------- | -------------- | | `p`,`padding` | `padding` | `spacing` | | `pl`, `paddingLeft` | `padding-left` | `spacing` | | `pr`, `paddingRight` | `padding-right` | `spacing` | | `pt`, `paddingTop` | `padding-top` | `spacing` | | `pb`, `paddingBottom` | `padding-bottom` | `spacing` | | `px`, `paddingX` | `padding-inline` | `spacing` | | `py`, `paddingY` | `padding-block` | `spacing` | | `ps`, `paddingStart` | `padding-inline-start` | `spacing` | | `pe`, `paddingEnd` | `padding-inline-end` | `spacing` | ## Margin ### All sides Use the `margin` prop to apply margin on all sides of an element ```jsx // shorthand ``` | Prop | CSS Property | Token Category | | ------------ | ------------ | -------------- | | `m`,`margin` | `margin` | `spacing` | ### Specific side Use the `margin{Left,Right,Top,Bottom}` to apply margin on one side of an element ```jsx // shorthand // shorthand ``` Use the `margin{Start,End}` properties to apply margin on the logical axis of an element based on the text direction. ```jsx // shorthand // shorthand ``` | Prop | CSS Property | Token Category | | -------------------- | --------------------- | -------------- | | `ml`, `marginLeft` | `margin-left` | `spacing` | | `mr`, `marginRight` | `margin-right` | `spacing` | | `mt`, `marginTop` | `margin-top` | `spacing` | | `mb`, `marginBottom` | `margin-bottom` | `spacing` | | `ms`, `marginStart` | `margin-inline-start` | `spacing` | | `me`, `marginEnd` | `margin-inline-end` | `spacing` | ### Horizontal and Vertical margin Use the `margin{X,Y}` properties to apply margin on the horizontal and vertical axis of an element ```jsx // shorthand // shorthand ``` | Prop | CSS Property | Token Category | | --------------- | ------------- | -------------- | | `mx`, `marginX` | `margin-left` | `spacing` | | `my`, `marginY` | `margin-top` | `spacing` | ## Spacing Between Use the `space{X,Y}` props to apply spacing between elements. This approach uses the owl selector `> * + *` to apply the spacing between the elements using `margin*` properties. :::info It's recommended to use the `space` prop over the `gap` prop for spacing when you need negative spacing. ::: ```jsx Item 1 Item 2 Item 3 Item 1 Item 2 Item 3 ``` | Prop | CSS Property | Token Category | | -------- | --------------------- | -------------- | | `spaceX` | `margin-inline-start` | `spacing` | | `spaceY` | `margin-block-start` | `spacing` |