---
title: "Code Blocks"
description: "Render syntax-highlighted source with a filename and copy action."
canonical_url: "https://indocio.igrislabs.com/components/code-blocks"
---

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

## Usage

Use a fenced code block with a language and optional filename. The Markdown renderer supplies `DocsCode` automatically.

```ts [nuxt.config.ts]
export default defineNuxtConfig({
  extends: ['@igrislabs/indocio'],
})
```

```md
```ts [nuxt.config.ts]
export default defineNuxtConfig({
  extends: ['@igrislabs/indocio'],
})
```
```

## Direct component usage

<docs-code code="const project = 'Indocio'" filename="example.ts" language="ts">



</docs-code>

```md
::docs-code{code="const project = 'Indocio'" language="ts" filename="example.ts"}
::
```

<table>
<thead>
  <tr>
    <th>
      Prop
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Default
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        code
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Required
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        filename
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Unset
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        language
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Inferred from the filename, otherwise <code>
        vue
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        header
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      <code>
        true
      </code>
    </td>
  </tr>
</tbody>
</table>

Use [Code tabs](https://indocio.igrislabs.com/components/code-tabs) to group examples, [Code Tree](https://indocio.igrislabs.com/components/code-tree) to browse source files, and [Package Commands](https://indocio.igrislabs.com/components/package-commands) for install commands.

## Markdown and MDC highlighting

Use `md`, `markdown`, or `mdc` for Markdown examples. Headings, emphasis, links, MDC component names and attributes, named slots, and YAML props receive syntax colors. Code fences inside the example keep their own language highlighting, including filenames and aliases such as `typescript`.

```md
## Example

::callout{title="Before you start" color="info"}
Write your documentation in Markdown.
::

```ts [example.ts]
export const project = 'Indocio'
```
```

## Sitemap

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