Skip to main content

Center

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 Center component used to automatically center children given a provided width and height.

Import

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

Code

<DhlCenter>
<DhlButton>0</DhlButton>
<DhlButton>1</DhlButton>
<DhlButton>2</DhlButton>
<DhlButton>3</DhlButton>
</DhlCenter>

Interactive Demo

Readme

Properties

PropertyAttributeDescriptionTypeDefault
directiondirectionAn optional prop used to define the flex-direction of the flex container."column" \| "column-reverse" \| "row" \| "row-reverse"undefined
gapgapAn optional prop used to define the gap of the flex container.string"var(--dui-size-space-0)"
hh[DEPRECATED] An optional prop used to define the height of the flex container.

string"auto"
heightheightAn optional prop used to define the height of the flex container.string"auto"
mm[DEPRECATED] An optional prop used to define the margin of the flex container.

string"var(--dui-size-space-0)"
marginmarginAn optional prop used to define the margin of the flex container.string"var(--dui-size-space-0)"
pp[DEPRECATED] An optional prop used to define the padding of the flex container.

string"var(--dui-size-space-0)"
paddingpaddingAn optional prop used to define the padding of the flex container.string"var(--dui-size-space-0)"
ww[DEPRECATED] An optional prop used to define the width of the flex container.

string"var(--dui-size-space-full)"
widthwidthAn optional prop used to define the width of the flex container.string"var(--dui-size-space-full)"

Slots

SlotDescription
"unnamed"unnamed children slot for elements to be aligned by DhlCenter

Dependencies

Depends on

Graph


Built by DHL User Interface Library Team!