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 β
{
"logo": {
"light": "/logo-light.png",
"dark": "/logo-dark.png"
},
"nav": [
{
"text": "π Home",
"link": "/",
"activeMatch": "^/$"
},
{
"text": "π Examples",
"link": "/markdown-examples",
"activeMatch": "^/(markdown-examples|api-examples)/"
},
{
"text": "π οΈ Tools",
"items": [
{
"text": "π€ NVIDIA",
"link": "/NVIDIA"
},
{
"text": "π Arduino",
"link": "/Arduino"
},
{
"text": "π Fusion 360",
"link": "/Fusion-360"
},
{
"text": "βοΈ OpenSource License",
"link": "/OpenSource-LIcense"
},
{
"text": "π¨οΈ 3D Printer",
"link": "/3D-Printer"
},
{
"text": "π₯ Laser Cutting",
"link": "/Laser-Cutting"
}
]
}
],
"sidebar": [
{
"text": "π Documentation",
"collapsible": true,
"collapsed": false,
"items": [
{
"text": "π― Markdown Examples",
"link": "/markdown-examples"
},
{
"text": "β‘ Runtime API Examples",
"link": "/api-examples"
}
]
},
{
"text": "π§ Tools & Technologies",
"collapsible": true,
"collapsed": false,
"items": [
{
"text": "Web Construction",
"link": "/Web-Construction"
},
{
"text": "π€ NVIDIA",
"link": "/NVIDIA"
},
{
"text": "π Arduino",
"link": "/Arduino"
},
{
"text": "π Fusion 360",
"link": "/Fusion-360"
},
{
"text": "βοΈ OpenSource License",
"link": "/OpenSource-LIcense"
},
{
"text": "π¨οΈ 3D Printer",
"link": "/3D-Printer"
},
{
"text": "π₯ Laser Cutting",
"link": "/Laser-Cutting"
}
]
}
],
"socialLinks": [
{
"icon": "github",
"link": "https://github.com/vuejs/vitepress",
"ariaLabel": "GitHub Repository"
},
{
"icon": "twitter",
"link": "https://twitter.com/vuejs",
"ariaLabel": "Twitter Account"
}
],
"footer": {
"message": "Released under the MIT License.",
"copyright": "Copyright Β© 2023-2025 My Fablab Project"
},
"editLink": {
"pattern": "https://github.com/vuejs/vitepress/edit/main/docs/:path",
"text": "Edit this page on GitHub"
},
"lastUpdated": {
"text": "Last updated",
"formatOptions": {
"dateStyle": "full",
"timeStyle": "medium"
}
},
"search": {
"provider": "local",
"options": {
"detailedView": true
}
},
"outline": {
"level": [
2,
3
],
"label": "On this page"
},
"docFooter": {
"prev": "β¬
οΈ Previous page",
"next": "Next page β‘οΈ"
},
"returnToTop": true
}Page Data β
{
"title": "Runtime API Examples",
"description": "",
"frontmatter": {
"outline": "deep"
},
"headers": [],
"relativePath": "api-examples.md",
"filePath": "api-examples.md",
"lastUpdated": 1761037200000
}Page Frontmatter β
{
"outline": "deep"
}More β
Check out the documentation for the full list of runtime APIs.

