<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-5HGSQD2L" height="0" width="0" style="display:none;visibility:hidden" title="GTM"></iframe>

Box

A basic building block that can be used as a simple container or the foundations of a component.

Use Box...

  • If you need a simple container with spacing.
  • As the starting point of a component that understands the core SWAN props.

Don't use Box...

  • If an existing SWAN component can be used instead.

The preview has been updated.

React API

Box is available for React API only. It is the basic building-block of a SWAN component. It understands all SWANs core props like spacing, background color, and visuallyHidden.

The preview has been updated.

Vanilla API

Box is not available for Vanilla API. You can add the SWAN CSS classes to whatever HTML element you'd like, such as div.

The preview has been updated.

Props

Box
This component is implemented using the <div /> as the root element. You can utilize the native attributes supported by <div /> tag. The ref is directly assigned to the root element, allowing you to access and manipulate it as needed.
See core props for additional props that can be applied to this component.
Was this page useful?

Thanks for your feedback!

Feel free to include your name if you wish to have a follow up conversation.


Published: Jan 31, 2022Last updated: Sep 18, 2024