Skip to main content

Spacer

danger

This component will be marked as deprecated and removed in an upcoming version of the component library.

Please avoid using this component in new implementations and consider replacing its current implementation with dhl-grid-container in combination with dhl-grid-cell.

A layout utility Spacer component, used in conjuction with the Flex component to span 100% of the available empty space between child components.

Import

// with @dhl-official/react-library:
import { DhlSpacer } from "@dhl-official/react-library"
// with @dhl-official/ui-libraries/react-library:
import { DhlSpacer } from "@dhl-official/ui-libraries/react-library"

Code

<DhlFlex>
<DhlButton>0</DhlButton>
<DhlButton>1</DhlButton>
<DhlSpacer />
<DhlButton>2</DhlButton>
<DhlButton>3</DhlButton>
</DhlFlex>
info

It is highly recommended to use Design Tokens for spacing values.

However, other valid values are supported if passed as string e.g. "auto" or "12px" for custom cases.

Interactive Demo

Readme


Built by DHL User Interface Library Team!