Skip to content

Components 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": "Polish Checklist",
          "link": "/cookbook/polish-checklist"
        }
      ]
    },
    {
      "text": "Box Props",
      "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": "Sizing",
          "link": "/styling/size/size",
          "items": [
            {
              "text": "Fixed",
              "link": "/styling/size/fixed"
            },
            {
              "text": "Grow",
              "link": "/styling/size/grow"
            },
            {
              "text": "Shrink",
              "link": "/styling/size/shrink"
            },
            {
              "text": "Aspect Ratio",
              "link": "/styling/size/aspect-ratio"
            },
            {
              "text": "CSS",
              "link": "/styling/size/css"
            }
          ]
        },
        {
          "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": "Decorating",
          "link": "/styling/overview"
        },
        {
          "text": "Text Styling",
          "link": "/styling/overview"
        },
        {
          "text": "Interactions",
          "link": "/styling/interactions"
        }
      ]
    },
    {
      "text": "Components",
      "items": [
        {
          "text": "Overview",
          "link": "/components/overview"
        },
        {
          "text": "AppBar",
          "link": "/components/appbar"
        },
        {
          "text": "Body",
          "link": "/components/body"
        },
        {
          "text": "Box",
          "link": "/components/box"
        },
        {
          "text": "Button",
          "link": "/components/button"
        },
        {
          "text": "Card",
          "link": "/components/card"
        },
        {
          "text": "Column",
          "link": "/components/column"
        },
        {
          "text": "Circular Progress Indicator",
          "link": "/components/circularprogressindicator"
        },
        {
          "text": "Delete Dialog",
          "link": "/components/deletedialog"
        },
        {
          "text": "Dialog",
          "link": "/components/dialog"
        },
        {
          "text": "Field",
          "link": "/components/field"
        }
      ]
    }
  ],
  "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": "Components Overview",
  "description": "",
  "frontmatter": {
    "outline": "deep"
  },
  "headers": [],
  "relativePath": "components/overview.md",
  "filePath": "components/overview.md"
}

Page Frontmatter ​

{
  "outline": "deep"
}

More ​

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