Skip to content

Styling Overview

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": "Home",
      "link": "/"
    },
    {
      "text": "Cookbook",
      "link": "/cookbook/quickstart"
    },
    {
      "text": "Docs",
      "link": "/styling/overview"
    }
  ],
  "sidebar": [
    {
      "text": "Cookbook",
      "items": [
        {
          "text": "Quickstart",
          "link": "/cookbook/quickstart"
        }
      ]
    },
    {
      "text": "Known Bugs",
      "items": [
        {
          "text": "Clicking Nested Elements",
          "link": "/known-bugs/clicking-nested-elements"
        }
      ]
    },
    {
      "text": "Styling",
      "items": [
        {
          "text": "Overview",
          "link": "/styling/overview"
        },
        {
          "text": "Size",
          "link": "/styling/size",
          "items": [
            {
              "text": "Width",
              "link": "/styling/size/width"
            },
            {
              "text": "Height",
              "link": "/styling/size/height"
            }
          ]
        },
        {
          "text": "Layout",
          "link": "/styling/layout",
          "items": [
            {
              "text": "Axis",
              "link": "/styling/layout/axis"
            },
            {
              "text": "Align",
              "link": "/styling/layout/align"
            },
            {
              "text": "Overflow",
              "link": "/styling/layout/overflow"
            },
            {
              "text": "Z Index",
              "link": "/styling/layout/z-index"
            }
          ]
        },
        {
          "text": "Decoration",
          "link": "/styling/overview"
        },
        {
          "text": "Text",
          "link": "/styling/overview"
        }
      ]
    },
    {
      "text": "Components",
      "items": [
        {
          "text": "Overview",
          "link": "/components/overview"
        },
        {
          "text": "AppBar",
          "link": "/components/appbar"
        },
        {
          "text": "Body",
          "link": "/components/body"
        }
      ]
    },
    {
      "text": "Theory",
      "items": [
        {
          "text": "Normalization",
          "link": "/theory/normalization"
        }
      ]
    }
  ],
  "socialLinks": [
    {
      "icon": "github",
      "link": "https://github.com/monode-dev/Miwi"
    },
    {
      "icon": "npm",
      "link": "https://www.npmjs.com/package/miwi"
    },
    {
      "icon": "x",
      "link": "https://twitter.com/melchiahmauck"
    }
  ]
}

Page Data

{
  "title": "Styling Overview",
  "description": "",
  "frontmatter": {
    "outline": "deep"
  },
  "headers": [],
  "relativePath": "styling/overview.md",
  "filePath": "styling/overview.md"
}

Page Frontmatter

{
  "outline": "deep"
}

More

Check out the documentation for the full list of runtime APIs.