---
title: "Markup"
description: "How the module reads your markup and how to steer it."
canonical_url: "https://kukson777.github.io/boneprint/docs/guide/markup"
---
# Markup

> How the module reads your markup and how to steer it.

## What becomes what

- Text becomes one bar per line.
- `img`, `video`, `canvas`, `svg`, `iframe` and form fields become a block, and so do CSS icons drawn through a mask, like Nuxt UI's `UIcon`.
- A painted element with text, up to about three lines tall, counts as a chip or button and becomes one block.
- Table cells and elements with a divider on one side become bars.

Toggle the switches to see each rule at work:

<code-preview>
<markup-demo>



</markup-demo>

<template v-slot:code="">

```vue
<template>
  <Skeleton :loading>
    <UAvatar src="/emily.png" size="xl" />

    <h4>Emily Johnson</h4>

    <UBadge data-skeleton-skip label="Admin" />

    <p data-skeleton-block>
      Text becomes one bar per line, the avatar and the button become blocks.
    </p>

    <UButton label="Follow" />
  </Skeleton>
</template>
```

</template>
</code-preview>

## Attributes

<table>
<thead>
  <tr>
    <th>
      Attribute
    </th>
    
    <th>
      Effect
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        data-skeleton-block
      </code>
    </td>
    
    <td>
      draw the element as one block
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        data-skeleton-skip
      </code>
    </td>
    
    <td>
      leave the element out
    </td>
  </tr>
</tbody>
</table>

## Your own skeleton

A chart, a logo or a canvas doesn't measure well. Use the `#skeleton` slot to draw your own instead, and build it from `<SkeletonBox>`, which follows the same colors and shimmer as every other skeleton. It takes `width`, `height` and `radius`.

<code-preview>
<custom-skeleton-demo>



</custom-skeleton-demo>

<template v-slot:code="">

```vue
<template>
  <Skeleton :loading>
    <RevenueChart />

    <template #skeleton>
      <SkeletonBox width="100%" :height="128" />
    </template>
  </Skeleton>
</template>
```

</template>
</code-preview>

## Height

To fill the height of the parent, give the root a height:

<code-preview>
<full-height-demo>



</full-height-demo>

<template v-slot:code="">

```vue
<template>
  <div class="flex h-48 flex-col">
    <Skeleton class="min-h-0 flex-1" :loading>
      <div class="h-full overflow-auto">
        <p v-for="row in 12" :key="row">Row {{ row }}</p>
      </div>
    </Skeleton>
  </div>
</template>
```

</template>
</code-preview>

Margins of the content stay inside `<Skeleton>` and don't collapse with its neighbours.

## Side effects in the slot

Slot content mounts once for the skeleton and again for the content. Keep data fetching and subscriptions outside `<Skeleton>`.

When a component in the slot can't avoid them, `useInSkeleton()` tells it which copy it is in. It's `true` in the copy the skeleton is measured from:

```vue [PosterCard.vue]
<script setup lang="ts">
const inSkeleton = useInSkeleton()
// The sample would otherwise ask for sources too
const sources = useQuery({ queryKey: ['sources', props.id], queryFn: fetchSources, enabled: !inSkeleton })
</script>
```

Text that's only read to screen readers, like Tailwind's `sr-only`, sits in a clipped 1px box and draws no bone.


## Sitemap

See the full [sitemap](https://kukson777.github.io/boneprint/sitemap.md) for all pages.
