composables

useUnwrap()

A composable to unwrap slots, for advanced usage.

It can be used to achieve a similar behavior as unwrap prop from <ContentSlot> component.

Example:

<script setup lang="ts">
const { flatUnwrap } = useUnwrap()

</script>

<template>
  <ul>
    <li v-for="(item, index) of flatUnwrap($slots.default!(), ['ul'])" :key="index">
      ☑︎
      <span><ContentSlot :use="() => item" unwrap="li" /></span>
    </li>
  </ul>
</template>