Layout components are used to separate layout responsibilities from content and interactivity.

This is the separation of concerns that makes your dashboard maintainable and easy to reason about, and understanding these principles is key to building your interfaces effectively.

Box

import { Box } from "@propeldata/ui-kit";

Box is the most fundamental layout component. Box is used to:

  • Provide spacing to child elements.
  • Impose sizing constraints on content.
  • Control layout behavior within flex and grid containers.
  • Hide content based on screen size using its responsive display prop.

Flex

import { Box } from "@propeldata/ui-kit";

Flex component does everything that Box can do, but comes with an additional set of props to organize items along an axis. It provides convenient access to the CSS flexbox properties.

Grid

import { Grid } from "@propeldata/ui-kit";

Grid is used to organize the content in columns and rows. Like Box and Flex, it’s made to provide convenient access to the underlying CSS grid properties without any magic of its own.

Section

import { Section } from "@propeldata/ui-kit";

Section provides a consistent vertical spacing between the larger parts of your page content, creating a sense of hierarchy and separation. There’s just a few pre-defined sizes for different spacing levels to keep things simple and consistent.

Container

import { Container } from "@propeldata/ui-kit";

Container’s sole responsibility is to provide a consistent max-width to the content it wraps. Like Section, it comes just with a couple of pre-defined sizes that work well with common breakpoints and typical content widths for comfortable reading.


Common layout props

Each layout component has a set of it’s own specialized props and also a shared set of common layout props. All layout props support responsive object values.

Padding

Padding props can access the space scale steps or accept any valid CSS padding value.

<Box p="4" />
<Box p="100px">
<Box p={{ sm: '6', lg: '9' }}>
PropTypeDefault
pResponsive<number | string>No default value
pxResponsive<number | string>No default value
pyResponsive<number | string>No default value
ptResponsive<number | string>No default value
prResponsive<number | string>No default value
pbResponsive<number | string>No default value
plResponsive<number | string>No default value

Width

Width props accept any valid CSS width value.

<Box width="100px" />
<Box width={{ md: '100vw', xl: '1400px' }} />
PropTypeDefault
widthResponsive<string>No default value
minWidthResponsive<string>No default value
maxWidthResponsive<string>No default value

Height

Height props accept any valid CSS height value.

<Box height="100px" />
<Box height={{ md: '100vh', xl: '600px' }} />
PropTypeDefault
heightResponsive<string>No default value
minHeightResponsive<string>No default value
maxHeightResponsive<string>No default value

Positioning

Positioning props can change how the element is placed relative to the normal flow of the document. As usual, the corresponding CSS values are accepted for each property, and the space scale steps can be used for the offset values.

<Box position="relative" />
<Box position={{ initial: "relative", lg: "sticky" }} />

<Box inset="4" />
<Box inset={{ initial: "0", xl: "auto" }} />

<Box left="4" />
<Box left={{ initial: "0", xl: "auto" }} />
PropTypeDefault
positionResponsive<enum>No default value
insetResponsive<enum | string>No default value
topResponsive<enum | string>No default value
rightResponsive<enum | string>No default value
bottomResponsive<enum | string>No default value
leftResponsive<enum | string>No default value

Flex children

Each layout component has props used to control the style when it is a child of a flex container.

<Box flexBasis="100%" />
<Box flexShrink="0">
<Box flexGrow={{ initial: "0", lg: "1" }} />
PropTypeDefault
flexBasisResponsive<string>No default value
flexShrinkResponsive<enum | string>No default value
flexGrowResponsive<enum | string>No default value

Grid children

Each layout component has props used to control the style when it is a child of a grid container.

<Box gridArea="header" />

<Box gridColumn="1 / 3" />
<Box gridColumnStart="2">
<Box gridColumnEnd={{ initial: "-1", md: "3", lg: "auto" }} />

<Box gridRow="1 / 3" />
<Box gridRowStart="2">
<Box gridRowEnd={{ initial: "-1", md: "3", lg: "auto" }} />
PropTypeDefault
gridAreaResponsive<string>No default value
gridColumnResponsive<string>No default value
gridColumnStartResponsive<string>No default value
gridColumnEndResponsive<string>No default value
gridRowResponsive<string>No default value
gridRowStartResponsive<string>No default value
gridRowEndResponsive<string>No default value

Margin props

Margin props are available on most components in order to provide spacing around the elements. They are not exclusive to layout components.

Margin props can access the space scale steps or accept any valid CSS margin value

<Button m="4" />
<Button m="100px">
<Button m={{ sm: '6', lg: '9' }}>
PropTypeDefault
mResponsive<enum | string>No default value
mxResponsive<enum | string>No default value
myResponsive<enum | string>No default value
mtResponsive<enum | string>No default value
mrResponsive<enum | string>No default value
mbResponsive<enum | string>No default value
mlResponsive<enum | string>No default value

The margin props may be unavailable on components that don’t render a HTML node or rely on their Root part for layout.