Skip to content

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/fossible-logo-light.svg",
    "dark": "/logo/fossible-logo-dark.svg"
  },
  "siteTitle": false,
  "nav": [
    {
      "text": "Digital Health",
      "items": [
        {
          "text": "Biograph",
          "link": "/products/biograph/",
          "icon": "lucide-heart",
          "subtitle": "CareOps & ERP Platform"
        },
        {
          "text": "Health Data Platform ",
          "link": "/products/medplum/",
          "icon": "lucide-database",
          "subtitle": "Medplum - FHIR CDR"
        },
        {
          "text": "The Fossible Stack ",
          "link": "/guide/stack",
          "icon": "lucide-layers",
          "subtitle": "Enterprise Stack"
        }
      ]
    },
    {
      "text": "Solutions",
      "link": "/solutions/"
    },
    {
      "text": "Enterprise",
      "link": "/enterprise/"
    },
    {
      "text": "Resources",
      "items": [
        {
          "text": "Docs",
          "link": "/guide/biograph-docs/",
          "icon": "lucide-book-open",
          "subtitle": "Documentation"
        },
        {
          "text": "Blog",
          "link": "/blog/",
          "icon": "lucide-pencil",
          "subtitle": "Latest Updates"
        }
      ]
    },
    {
      "text": "|",
      "link": ""
    },
    {
      "text": "About",
      "link": "/about/"
    },
    {
      "text": "Contact Us",
      "link": "/contact/"
    }
  ],
  "sidebar": {
    "/guide/": [
      {
        "text": "Biograph Docs",
        "collapsed": true,
        "items": [
          {
            "text": "Overview",
            "link": "/guide/biograph-docs/"
          },
          {
            "text": "Architecture",
            "link": "/guide/biograph-docs/architecture"
          },
          {
            "text": "Glossary",
            "link": "/guide/biograph-docs/glossary"
          },
          {
            "text": "User Flows",
            "collapsed": true,
            "items": [
              {
                "text": "Flow Index",
                "link": "/guide/biograph-docs/user-flows/"
              },
              {
                "text": "Patient Registration",
                "link": "/guide/biograph-docs/user-flows/patient-registration"
              },
              {
                "text": "Appointment Booking (Desk)",
                "link": "/guide/biograph-docs/user-flows/appointment-booking-desk"
              },
              {
                "text": "Appointment Booking (Portal)",
                "link": "/guide/biograph-docs/user-flows/appointment-booking-portal"
              },
              {
                "text": "Recurring Appointments",
                "link": "/guide/biograph-docs/user-flows/recurring-appointments"
              },
              {
                "text": "Patient Encounter",
                "link": "/guide/biograph-docs/user-flows/patient-encounter"
              },
              {
                "text": "Lab Test Workflow",
                "link": "/guide/biograph-docs/user-flows/lab-test-workflow"
              },
              {
                "text": "Clinical Procedure",
                "link": "/guide/biograph-docs/user-flows/clinical-procedure"
              },
              {
                "text": "Inpatient Admission",
                "link": "/guide/biograph-docs/user-flows/inpatient-admission"
              },
              {
                "text": "Inpatient Medication",
                "link": "/guide/biograph-docs/user-flows/inpatient-medication"
              },
              {
                "text": "Therapy & Rehab",
                "link": "/guide/biograph-docs/user-flows/therapy-rehabilitation"
              },
              {
                "text": "Billing & Invoicing",
                "link": "/guide/biograph-docs/user-flows/billing-invoicing"
              },
              {
                "text": "Insurance Claims",
                "link": "/guide/biograph-docs/user-flows/insurance-claims"
              },
              {
                "text": "Portal Diagnostics",
                "link": "/guide/biograph-docs/user-flows/patient-portal-diagnostics"
              }
            ]
          },
          {
            "text": "Reference",
            "collapsed": true,
            "items": [
              {
                "text": "API Reference",
                "link": "/guide/biograph-docs/api-reference"
              },
              {
                "text": "Data Models",
                "link": "/guide/biograph-docs/data-models"
              },
              {
                "text": "Frontend Map",
                "link": "/guide/biograph-docs/frontend-map"
              },
              {
                "text": "Commands",
                "link": "/guide/biograph-docs/commands"
              },
              {
                "text": "Environment & Config",
                "link": "/guide/biograph-docs/env-vars"
              }
            ]
          }
        ]
      },
      {
        "text": "Getting Started",
        "items": [
          {
            "text": "Introduction",
            "link": "/guide/"
          },
          {
            "text": "Demo Sites",
            "link": "/guide/demo-sites"
          }
        ]
      },
      {
        "text": "Products & Services",
        "items": [
          {
            "text": "Espresso Cloud",
            "link": "/guide/espresso-cloud"
          },
          {
            "text": "Hydra AI",
            "link": "/guide/hydra-ai"
          },
          {
            "text": "Fossible Sprints",
            "link": "/guide/fossible-sprints"
          },
          {
            "text": "Fossible Stack",
            "link": "/guide/stack"
          }
        ]
      }
    ]
  }
}

Page Data

{
  "title": "Runtime API Examples",
  "description": "",
  "frontmatter": {
    "outline": "deep"
  },
  "headers": [],
  "relativePath": "api-examples.md",
  "filePath": "api-examples.md"
}

Page Frontmatter

{
  "outline": "deep"
}

More

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