Box

A generic layout container. Renders as any element via the as prop and applies padding from a fixed token scale.

Usage

<script>
  import { Box } from '@vultra/ui';
</script>

<Box as="section" padding={4}>
  <p>Content in a padded section.</p>
</Box>

<Box as="article" padding={2}>
  <p>Content in a padded article.</p>
</Box>

Props

PropTypeDefaultDescription
askeyof HTMLElementTagNameMap'div'Element to render
paddingnumber0Padding from the token scale (016)
classstringAdditional CSS classes
childrenSnippetBox content

Plus all standard HTML attributes, forwarded to the rendered element.

Features

  • Renders any element via as (section, article, header, main, …).
  • Padding restricted to the spacing token scale for consistent rhythm.
  • Forwards standard HTML attributes and events.
  • Works as a bare wrapper when padding is 0.