Skip to content
Bryce Russell edited this page Mar 22, 2023 · 2 revisions

Conditionally wrap elements

Example:

---
import { Wrap } from 'astro-headless-ui';
---
<Wrap wrap={true} as="div" class="test">
 <a href="#">Link</a>
</Wrap>

<Wrap wrap={false} as="div">
  <a href="#">Link</a>
</Wrap>
<div class="test">
  <a href="#">Link</a>
</div>

<a href="#">Link</a>

Props

wrap: boolean

Toggles the wrapping element on/off

as: string

The tag name of the element

...attrs

All other props are spread onto the wrapping element as attributes

Clone this wiki locally