Skip to main content
Design system

Box

This component is used to create a box element with a set of default styles. It's best used in protoyping and playing with components. For production code, we recommend using "styled" or "css" functions intead.

Bundle size: 0
Install:
npm install @washingtonpost/wpds-ui-kit
|Copy
Usage:
import { Box } from "@washingtonpost/wpds-ui-kit"
|Copy
Storybook:  View on Storybook
Source:  View on Github

Options

as

The as prop allows you to change the underlying HTML element that is rendered. This is useful for when you want to use a component that is not a div by default. Do not use this as to replace our Button component. Use the Button component for buttons.

css

The css props allows you to pass in a style object that will be applied to the underlying HTML element.


Guidance

Protoyping

This component is used to create a box element with a set of default styles. It's best used in protoyping and playing with components. For production code, we recommend using "styled" or "css" functions intead. Prototyping is a great way to get started with a new project. It's a great way to get a feel for the components you'll need and how they'll work together. It's also a great way to get a feel for the design system you'll be using.

Production

For production code, we recommend using "styled" or "css" functions intead. Production code is code that is ready to be shipped to production. It's code that we can be confident will work as expected like having built in best practices like accessibility and performance.


Accessibility

This component is not accessible by default. You should always use the as prop to change the underlying HTML element to something more semantic.


API Reference

Box

PropDescriptionTypeDefaultRequired
asWPDS provides an as prop for changing which tag a component outputs.
never
----False
cssWPDS provides a css prop for overriding styles easily. It’s like the style attribute, but it supports tokens, media queries, nesting and token-aware values. All WPDS Components include a css prop. Use it to pass in overrides.
CSS<{ sm: `(max-width: ${string})`; md: `(min-width: calc(${string} + 1px)) and (max-width: ${string})`; lg: `(min-width: calc(${string} + 1px)) and (max-width: ${string})`; xl: `(min-width: calc(${string} + 1px)) and (max-width: ${string})`; xxl: `(min-width: calc(${string} + 1px)) and (max-width: ${string})`; notS...
----False