Box
Loading
Content goes here
1<Box backgroundColor="tertiary" color="text">2 <p>Content goes here</p>3</Box>
Content goes here
1<Box backgroundColor="tertiary" color="text" padding="--s4">2 <p>Content goes here</p>3</Box>
Content goes here
1<Box backgroundColor="tertiary" color="text" padding="--s4" borderY borderColor="form" borderWidth="large">2 <p>Content goes here</p>3</Box>
1<Box2 backgroundColor="primary"3 color="text"4 padding="--s3"5 border6 borderColor="presentation"7 borderWidth="medium"8 as="aside"9>10 <p>Content goes here</p>11</Box>
The Box component is a versatile wrapping container that allows for various styling to be applied.
The Box component is a full width container that conforms to the site governed by its parent container.
Import by:
1import { Box } from '@parsley_design_systems/design-system'
| Property | Type | Default | Required | Description |
|---|---|---|---|---|
| children | ReactNode | true | The children nodes of the component. | |
| className | string | false | Allows for specific classNames to be set. | |
| p, padding | oneOf: --s-6, --s-5, --s-4, --s-3, --s-2, --s-1, --s0, --s1, --s2, --s3, --s4, --s5, --s6, --s7, --s8, 0 | 0 | false | Allow a uniform padding to be applied on the parent container. A padding of 0 is the default. |
| pt, paddingTop | oneOf: --s-6, --s-5, --s-4, --s-3, --s-2, --s-1, --s0, --s1, --s2, --s3, --s4, --s5, --s6, --s7, --s8, 0 | 0 | false | Sets the padding-top. |
| pr, paddingRight | oneOf: --s-6, --s-5, --s-4, --s-3, --s-2, --s-1, --s0, --s1, --s2, --s3, --s4, --s5, --s6, --s7, --s8, 0 | 0 | false | Sets the padding-right. |
| pb, paddingBottom | oneOf: --s-6, --s-5, --s-4, --s-3, --s-2, --s-1, --s0, --s1, --s2, --s3, --s4, --s5, --s6, --s7, --s8, 0 | 0 | false | Sets the padding-bottom. |
| pl, paddingLeft | oneOf: --s-6, --s-5, --s-4, --s-3, --s-2, --s-1, --s0, --s1, --s2, --s3, --s4, --s5, --s6, --s7, --s8, 0 | 0 | false | Sets the padding-left. |
| px, paddingX | oneOf: --s-6, --s-5, --s-4, --s-3, --s-2, --s-1, --s0, --s1, --s2, --s3, --s4, --s5, --s6, --s7, --s8, 0 | 0 | false | Sets the padding left and right. |
| py, paddingY | oneOf: --s-6, --s-5, --s-4, --s-3, --s-2, --s-1, --s0, --s1, --s2, --s3, --s4, --s5, --s6, --s7, --s8, 0 | 0 | false | Sets the padding top and bottom. |
| borderLeft | boolean | false | Required to display the left border | |
| borderRight | boolean | false | Required to display the right border | |
| borderTop | boolean | false | Required to display the top border | |
| borderBottom | boolean | false | Required to display the bottom border | |
| borderX | boolean | false | Required to display the left and right borders | |
| borderY | boolean | false | Required to display the top and bottom borders | |
| border | boolean | false | Required to display the border on all 4 sides. | |
| borderWidth | oneOf: small, medium, large, default | none | false | Sets the border-width. |
| borderLeftWidth | oneOf: small, medium, large, default | none | false | Sets the border-width. |
| borderRightWidth | oneOf: small, medium, large, default | none | false | Sets the border-width. |
| borderTopWidth | oneOf: small, medium, large, default | none | false | Sets the border-width. |
| borderBottomWidth | oneOf: small, medium, large, default | none | false | Sets the border-width. |
| borderColor | oneOf: presentation, form, utility, utility2, critical, warning, information, success, default | none | false | Sets the border-color. |
| borderRadius | oneOf: small, medium, large, default | 0 | false | Sets the border radius. |
| color | oneOf: text, heading, subdued, primaryInverse, headingInverse, subduedInverse, utility, interactive, interactiveSecondary, interactiveInverse, selectedPrimary, selectedSecondary, border, primary, secondary, tertiary, fourth, fifth, sixth, critical, warning, information, success, default | false | Allows for a colour to be set on the component. | |
| backgroundColor | oneOf: background, secondary, tertiary, primaryInverse, secondaryInverse, tertiaryInverse, primary, secondary, tertiary, fourth, fifth, sixth, critical, warning, information, success, selectedPrimary, selectedSecondary, default | false | Allows for a background colour to be set on the component. | |
| display | oneOf: block, flex, inline, inline-block, inline-flex, none, grid, inline-grid, table, table-row-group, table-header-group, table-footer-group, table-row, table-cell, table-column-group, table-column, table-caption | block | false | Allows for the display to be set on the component. |
| fontSize | string - see the typographic scale in Typography | --ts0 | false | Allows for a font size to be set on the component. |
| fontWeight | string - see the typeface weights in Typography | regular | false | Allows for a font weight to be set on the component. |
| fontFamily | string - plain | heading | default | default | false | Allows for a font family to be set on the component. |
| lineHeight | string - see the typeface line heights in Typography | medium - 150% | false | Allows for a line height to be set on the component. |
| textAlign | oneOf: left, center, right, justified | left | false | Allows for a text align to be set on the component. |
| w, width | string | false | The prop allows the width to be set on the container. The width tokens can be used otherwise the value is intentionally open to allow for varying needs. | |
| minWidth | string | false | The prop allows the minimum width to be set on the container. The minWidth tokens can be used otherwise the value is intentionally open to allow for varying needs. | |
| maxWidth | string | false | The prop allows the maximum width to be set on the container. The maxWidth tokens can be used otherwise the value is intentionally open to allow for varying needs. | |
| h, height | string | false | The prop allows the height to be set on the container. This value is intentionally open to allow for varying needs. | |
| minHeight | string | false | The prop allows the minimum height to be set on the container. This value is intentionally open to allow for varying needs. | |
| maxHeight | string, array, object | false | The prop allows the maximum height to be set on the container. This value is intentionally open to allow for varying needs. | |
| flex | number | string | false | Shorthand for flex-grow, flex-shrink and flex-basis combined. | |
| flexBasis | number | string | false | Defines the default size of an element before the remaining space is distributed. | |
| flexWrap | oneOf: nowrap, wrap, wrap-reverse | false | By default flex items will all try to fit onto one line, flex wrap can change that and allow the items to wrap as needed with this property. | |
| flexGrow | number | false | Defines the ability for a flex item to grow if necessary. | |
| flexShrink | number | false | Defines the ability for a flex item to shrink if necessary. | |
| as | A valid HTML5 element | div | false | Allowing for polymorphic elements, only the following elements should be considered. A div element is the default.
|