---
title: "Code Preview"
description: "Pair a rendered example with its source code."
canonical_url: "https://indocio.igrislabs.com/components/code-preview"
---

> Index of every page on this site: [llms.txt](https://indocio.igrislabs.com/llms.txt)

## Usage

Use the `preview` slot for the rendered example and `code` for its source.

<code-preview title="Button example">
<template v-slot:preview="">
<ui-button color="primary">

Get started

</ui-button>
</template>

<template v-slot:code="">

```vue
<UiButton color="primary">Get started</UiButton>
```

</template>
</code-preview>

```md
::code-preview{title="Button example"}
#preview
:ui-button{color="primary"}[Get started]
#code

```vue
<UiButton color="primary">Get started</UiButton>
```

::
```

`title` defaults to `Preview`. The default slot can also supply the preview. This displays authored content; it does not execute code strings.

## Sitemap

See the full [sitemap](https://indocio.igrislabs.com/sitemap.md) for all pages.
