Balance Logo
Balance
Reckon Design System

Box

The box primitive allows consumers to implement aesthetic changes within the constraints of the theme.
Install
pnpm add @reckon-web/box
Import usage
import {
Box,
useBoxStyles
} from '@reckon-web/box';
  • Code
  • API

Box is the most abstract component on top of which most other primitive components are built. By default it renders a div element.

Usage

The Box component is useful for a variety of cases:

  • Create responsive layouts
  • Implement basic styles within the constraints of the theme
  • Compose new components and support overriding the underlying element using the as prop

Padding

The padding keys allow targeting each side as well as the x-axis and y-axis.

  • padding
  • paddingTop
  • paddingRight
  • paddingBottom
  • paddingLeft
  • paddingX padding-left and padding-right
  • paddingY padding-top and padding-bottom
padding
Open in Playroom

Margin

The margin keys allow targeting each side as well as the x-axis and y-axis.

  • margin
  • marginTop
  • marginRight
  • marginBottom
  • marginLeft
  • marginX margin-left and margin-right
  • marginY margin-top and margin-bottom
margin

Rounding

The rounding keys allow targeting each box side.

  • rounding border-radius
  • roundingBottom border-bottom-left-radius and border-bottom-right-radius
  • roundingLeft border-bottom-left-radius and border-top-left-radius
  • roundingRight border-bottom-right-radius and border-top-right-radius
  • roundingTop border-bottom-left-radius and border-bottom-right-radius

The rounding values don't follow the traditional t-shirt sizes.

  • none
  • small
  • medium
  • large
rounding

Text Align

Align the text within a box:

  • textAlign text-align CSS property

The available values match the CSS property:

  • left
  • right
  • center
  • justify
  • start
  • end
centered text

Height

Set the height of a box:

  • height height CSS property
100px tall

Width

Set the width of a box:

  • width width CSS property
200px wide

Combined

Mix and match style properties to achieve the desired aesthetic.

combined

Responsive Props

Instead of manually managing media queries and adding nested style objects throughout a code base, we offer a convenient shorthand syntax for adding responsive styles with a mobile-first approach.

Each of the above style props accepts a value or array of values. To skip certain breakpoints, you can pass null to any position in the array to avoid generating unnecessary CSS.

While this approach has been widely adopted with great success, much like any new idea, it can seem odd or off-putting at first. We recommend giving it a chance.

responsive props
Copyright © 2021 Reckon. Designed and developed in partnership with Thinkmill.