Runtime API Examples
This page demonstrates usage of some of the runtime APIs provided by VitePress.
The main useData() API can be used to access site, theme, and page data for the current page. It works in both .md and .vue files:
md
<script setup>
import { useData } from 'vitepress'
const { theme, page, frontmatter } = useData()
</script>
## Results
### Theme Data
<pre>{{ theme }}</pre>
### Page Data
<pre>{{ page }}</pre>
### Page Frontmatter
<pre>{{ frontmatter }}</pre>Results
Theme Data
{
"nav": [
{
"text": "Inicio",
"link": "/"
},
{
"text": "Producto",
"link": "/producto/vision"
},
{
"text": "Técnico",
"link": "/tecnico/arquitectura"
},
{
"text": "Guías",
"link": "/guias/instalacion"
}
],
"sidebar": [
{
"text": "📦 Producto",
"collapsed": false,
"items": [
{
"text": "Visión",
"link": "/producto/vision"
},
{
"text": "Historias de Usuario",
"link": "/producto/historias"
},
{
"text": "Requisitos",
"link": "/producto/requisitos"
},
{
"text": "Roadmap",
"link": "/producto/roadmap"
}
]
},
{
"text": "🔧 Técnico",
"collapsed": false,
"items": [
{
"text": "Arquitectura",
"link": "/tecnico/arquitectura"
},
{
"text": "Base de Datos",
"link": "/tecnico/base-datos"
},
{
"text": "Backend",
"link": "/tecnico/backend"
},
{
"text": "API Reference",
"link": "/tecnico/api"
}
]
},
{
"text": "📚 Guías",
"collapsed": false,
"items": [
{
"text": "Instalación",
"link": "/guias/instalacion"
},
{
"text": "Git Workflow",
"link": "/guias/git-workflow"
},
{
"text": "Estándares de Código",
"link": "/guias/estandares"
}
]
},
{
"text": "📝 Ejemplos",
"collapsed": true,
"items": [
{
"text": "Markdown Examples",
"link": "/markdown-examples"
},
{
"text": "API Examples",
"link": "/api-examples"
}
]
}
],
"outline": {
"level": [
2,
3
],
"label": "En esta página"
},
"socialLinks": [
{
"icon": "github",
"link": "https://github.com/cegonmen1/aulix-docs"
}
],
"footer": {
"message": "Documentación Aulix SAAS",
"copyright": "© 2025 Aulix"
},
"search": {
"provider": "local"
},
"editLink": {
"pattern": "https://github.com/cegonmen1/aulix-docs/edit/main/docs/:path",
"text": "Editar esta página en GitHub"
},
"lastUpdated": {
"text": "Última actualización",
"formatOptions": {
"dateStyle": "short",
"timeStyle": "short"
}
}
}Page Data
{
"title": "Runtime API Examples",
"description": "",
"frontmatter": {
"outline": "deep"
},
"headers": [],
"relativePath": "api-examples.md",
"filePath": "api-examples.md",
"lastUpdated": 1766801069000
}Page Frontmatter
{
"outline": "deep"
}More
Check out the documentation for the full list of runtime APIs.