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": {
    "src": "/img/logo/logo.svg",
    "alt": "Logo VSC"
  },
  "siteTitle": "VSC Guide",
  "nav": [
    {
      "text": "Beranda",
      "link": "/"
    },
    {
      "text": "Panduan",
      "link": "/panduan/mengenal-vsc-erp"
    },
    {
      "text": "Aplikasi",
      "items": [
        {
          "text": "VSC Backoffice",
          "link": "/backoffice/overview"
        },
        {
          "text": "VSC POS",
          "link": "/pos/overview"
        },
        {
          "text": "VSC KDS",
          "link": "/kds/overview"
        },
        {
          "text": "VSC Order",
          "link": "/order/overview"
        },
        {
          "text": "VSC Team",
          "link": "/team/overview"
        }
      ]
    }
  ],
  "sidebar": [
    {
      "text": "Panduan Awal",
      "items": [
        {
          "text": "Perkenalan",
          "link": "/panduan/mengenal-vsc-erp"
        },
        {
          "text": "Memulai",
          "link": "/panduan/mulai-cepat"
        }
      ]
    },
    {
      "text": "VSC Backoffice",
      "collapsed": false,
      "items": [
        {
          "text": "Overview Backoffice",
          "link": "/backoffice/overview"
        },
        {
          "text": "Dashboard",
          "link": "/backoffice/dashboard"
        },
        {
          "text": "Approval",
          "link": "/backoffice/approval"
        },
        {
          "text": "Master Data",
          "link": "/backoffice/master-data/overview",
          "collapsed": true,
          "items": [
            {
              "text": "Overview",
              "link": "/backoffice/master-data/overview"
            },
            {
              "text": "General",
              "collapsed": true,
              "items": [
                {
                  "text": "Company",
                  "link": "/backoffice/master-data/general/company"
                },
                {
                  "text": "Outlet",
                  "link": "/backoffice/master-data/general/outlet"
                },
                {
                  "text": "Department",
                  "link": "/backoffice/master-data/general/department"
                },
                {
                  "text": "Store",
                  "link": "/backoffice/master-data/general/store"
                },
                {
                  "text": "Currency",
                  "link": "/backoffice/master-data/general/currency"
                },
                {
                  "text": "Payment Type",
                  "link": "/backoffice/master-data/general/payment-type"
                },
                {
                  "text": "Courier",
                  "link": "/backoffice/master-data/general/courier"
                },
                {
                  "text": "Commission",
                  "link": "/backoffice/master-data/general/commission"
                },
                {
                  "text": "Tax",
                  "link": "/backoffice/master-data/general/tax"
                },
                {
                  "text": "Production Step",
                  "link": "/backoffice/master-data/general/production-step"
                },
                {
                  "text": "QC Parameter",
                  "link": "/backoffice/master-data/general/qc-parameter"
                },
                {
                  "text": "QC Point",
                  "link": "/backoffice/master-data/general/qc-point"
                },
                {
                  "text": "Item QC Parameter",
                  "link": "/backoffice/master-data/general/item-qc-parameter"
                },
                {
                  "text": "Device & Printer",
                  "link": "/backoffice/master-data/general/device-printer"
                },
                {
                  "text": "Category Cash Flow",
                  "link": "/backoffice/master-data/general/category-cash-flow"
                }
              ]
            },
            {
              "text": "People",
              "collapsed": true,
              "items": [
                {
                  "text": "Customer Group",
                  "link": "/backoffice/master-data/people/customer-group"
                },
                {
                  "text": "Customer",
                  "link": "/backoffice/master-data/people/customer"
                },
                {
                  "text": "Customer Prepaid",
                  "link": "/backoffice/master-data/people/customer-prepaid"
                },
                {
                  "text": "Customer Point",
                  "link": "/backoffice/master-data/people/customer-point"
                },
                {
                  "text": "Customer Discount",
                  "link": "/backoffice/master-data/people/customer-discount"
                },
                {
                  "text": "Entitle",
                  "link": "/backoffice/master-data/people/entitle"
                },
                {
                  "text": "Staff Position",
                  "link": "/backoffice/master-data/people/staff-position"
                },
                {
                  "text": "Staff",
                  "link": "/backoffice/master-data/people/staff"
                },
                {
                  "text": "Supplier Group",
                  "link": "/backoffice/master-data/people/supplier-group"
                },
                {
                  "text": "Supplier",
                  "link": "/backoffice/master-data/people/supplier"
                },
                {
                  "text": "Supplier Contract",
                  "link": "/backoffice/master-data/people/supplier-contract"
                }
              ]
            },
            {
              "text": "Product",
              "collapsed": true,
              "items": [
                {
                  "text": "Item Stock Unit",
                  "link": "/backoffice/master-data/product/item-stock-unit"
                },
                {
                  "text": "Item Stock Group",
                  "link": "/backoffice/master-data/product/item-stock-group"
                },
                {
                  "text": "Item Stock",
                  "link": "/backoffice/master-data/product/item-stock"
                },
                {
                  "text": "Brand",
                  "link": "/backoffice/master-data/product/brand"
                },
                {
                  "text": "Variant",
                  "link": "/backoffice/master-data/product/variant"
                },
                {
                  "text": "Item Sale Category",
                  "link": "/backoffice/master-data/product/item-sale-category"
                },
                {
                  "text": "Item Sale",
                  "link": "/backoffice/master-data/product/item-sale"
                },
                {
                  "text": "Condiment",
                  "link": "/backoffice/master-data/product/condiment"
                },
                {
                  "text": "Print Barcode",
                  "link": "/backoffice/master-data/product/print-barcode"
                }
              ]
            },
            {
              "text": "POS",
              "collapsed": true,
              "items": [
                {
                  "text": "Table",
                  "link": "/backoffice/master-data/pos/table"
                },
                {
                  "text": "Table Layout",
                  "link": "/backoffice/master-data/pos/table-layout"
                },
                {
                  "text": "Setup Price",
                  "link": "/backoffice/master-data/pos/setup-price"
                },
                {
                  "text": "Setup Discount",
                  "link": "/backoffice/master-data/pos/setup-discount"
                },
                {
                  "text": "Setup Promotion",
                  "link": "/backoffice/master-data/pos/setup-promotion"
                },
                {
                  "text": "Shift",
                  "link": "/backoffice/master-data/pos/shift"
                },
                {
                  "text": "Voucher",
                  "link": "/backoffice/master-data/pos/voucher"
                }
              ]
            },
            {
              "text": "Location",
              "collapsed": true,
              "items": [
                {
                  "text": "Country",
                  "link": "/backoffice/master-data/location/country"
                },
                {
                  "text": "Province",
                  "link": "/backoffice/master-data/location/province"
                },
                {
                  "text": "City",
                  "link": "/backoffice/master-data/location/city"
                },
                {
                  "text": "District",
                  "link": "/backoffice/master-data/location/district"
                }
              ]
            }
          ]
        },
        {
          "text": "Sales",
          "link": "/backoffice/sales/overview",
          "collapsed": true,
          "items": [
            {
              "text": "Overview",
              "link": "/backoffice/sales/overview"
            },
            {
              "text": "Sales Order",
              "link": "/backoffice/sales/sales-order"
            },
            {
              "text": "Sales List",
              "link": "/backoffice/sales/sales-list"
            },
            {
              "text": "Delivery Order",
              "link": "/backoffice/sales/delivery-order"
            },
            {
              "text": "Return From Customer",
              "link": "/backoffice/sales/return-from-customer"
            }
          ]
        },
        {
          "text": "Purchasing",
          "link": "/backoffice/purchasing/overview",
          "collapsed": true,
          "items": [
            {
              "text": "Overview",
              "link": "/backoffice/purchasing/overview"
            },
            {
              "text": "Market List",
              "link": "/backoffice/purchasing/market-list"
            },
            {
              "text": "Purchase Request",
              "link": "/backoffice/purchasing/purchase-request"
            },
            {
              "text": "Direct Purchase",
              "link": "/backoffice/purchasing/direct-purchase"
            },
            {
              "text": "Purchase Order",
              "link": "/backoffice/purchasing/purchase-order"
            },
            {
              "text": "Receiving",
              "link": "/backoffice/purchasing/receiving"
            },
            {
              "text": "Return To Supplier",
              "link": "/backoffice/purchasing/return-to-supplier"
            }
          ]
        },
        {
          "text": "Inventory",
          "link": "/backoffice/inventory/overview",
          "collapsed": true,
          "items": [
            {
              "text": "Overview",
              "link": "/backoffice/inventory/overview"
            },
            {
              "text": "Store Request",
              "link": "/backoffice/inventory/store-request"
            },
            {
              "text": "Picking List",
              "link": "/backoffice/inventory/picking-list"
            },
            {
              "text": "Item Transfer",
              "link": "/backoffice/inventory/item-transfer"
            },
            {
              "text": "Item Mutation",
              "link": "/backoffice/inventory/item-mutation"
            },
            {
              "text": "Item Receiving",
              "link": "/backoffice/inventory/item-receiving"
            },
            {
              "text": "Stock Opname",
              "link": "/backoffice/inventory/stock-opname"
            },
            {
              "text": "Adjustment",
              "link": "/backoffice/inventory/adjustment"
            },
            {
              "text": "Item Last Balance",
              "link": "/backoffice/inventory/item-last-balance"
            },
            {
              "text": "Stock Card",
              "link": "/backoffice/inventory/stock-card"
            },
            {
              "text": "Closing Inventory",
              "link": "/backoffice/inventory/closing-inventory"
            }
          ]
        },
        {
          "text": "Production",
          "link": "/backoffice/production/overview",
          "collapsed": true,
          "items": [
            {
              "text": "Overview",
              "link": "/backoffice/production/overview"
            },
            {
              "text": "Work Order",
              "link": "/backoffice/production/work-order"
            },
            {
              "text": "Production Process",
              "link": "/backoffice/production/production-process"
            },
            {
              "text": "Finishing Goods",
              "link": "/backoffice/production/finishing-goods"
            },
            {
              "text": "Quality Control",
              "link": "/backoffice/production/quality-control"
            },
            {
              "text": "Repack",
              "link": "/backoffice/production/repack"
            }
          ]
        },
        {
          "text": "Account Payable",
          "link": "/backoffice/account-payable/overview",
          "collapsed": true,
          "items": [
            {
              "text": "Overview",
              "link": "/backoffice/account-payable/overview"
            },
            {
              "text": "AP List",
              "link": "/backoffice/account-payable/ap-list"
            },
            {
              "text": "AP Aging",
              "link": "/backoffice/account-payable/ap-aging"
            },
            {
              "text": "AP Other",
              "link": "/backoffice/account-payable/ap-other"
            },
            {
              "text": "AP Open Balance",
              "link": "/backoffice/account-payable/ap-open-balance"
            },
            {
              "text": "Supplier Deposit",
              "link": "/backoffice/account-payable/supplier-deposit"
            }
          ]
        },
        {
          "text": "Account Receivable",
          "link": "/backoffice/account-receivable/overview",
          "collapsed": true,
          "items": [
            {
              "text": "Overview",
              "link": "/backoffice/account-receivable/overview"
            },
            {
              "text": "AR List",
              "link": "/backoffice/account-receivable/ar-list"
            },
            {
              "text": "AR Aging",
              "link": "/backoffice/account-receivable/ar-aging"
            },
            {
              "text": "AR Other",
              "link": "/backoffice/account-receivable/ar-other"
            },
            {
              "text": "AR Open Balance",
              "link": "/backoffice/account-receivable/ar-open-balance"
            },
            {
              "text": "Customer Deposit",
              "link": "/backoffice/account-receivable/customer-deposit"
            }
          ]
        },
        {
          "text": "Accounting",
          "link": "/backoffice/accounting/overview",
          "collapsed": true,
          "items": [
            {
              "text": "Overview",
              "link": "/backoffice/accounting/overview"
            },
            {
              "text": "Posting Transaction",
              "link": "/backoffice/accounting/posting-transaction"
            },
            {
              "text": "Journal",
              "link": "/backoffice/accounting/journal"
            },
            {
              "text": "General Ledger",
              "link": "/backoffice/accounting/general-ledger"
            },
            {
              "text": "Closing Journal",
              "link": "/backoffice/accounting/closing-journal"
            },
            {
              "text": "Monthly Closing",
              "link": "/backoffice/accounting/monthly-closing"
            },
            {
              "text": "Transfer Cash / Bank",
              "link": "/backoffice/accounting/transfer-cash-bank"
            },
            {
              "text": "Prepaid",
              "link": "/backoffice/accounting/prepaid"
            },
            {
              "text": "Fixed Asset",
              "link": "/backoffice/accounting/fixed-asset"
            },
            {
              "text": "Reimburse",
              "link": "/backoffice/accounting/reimburse"
            },
            {
              "text": "Cash Advance",
              "link": "/backoffice/accounting/cash-advance"
            },
            {
              "text": "Chart of Accounts",
              "link": "/backoffice/accounting/chart-of-accounts"
            },
            {
              "text": "Account Budgeting",
              "link": "/backoffice/accounting/account-budgeting"
            },
            {
              "text": "Accounting Report",
              "link": "/backoffice/accounting/accounting-report"
            },
            {
              "text": "Accounting Setting",
              "link": "/backoffice/accounting/accounting-setting"
            }
          ]
        },
        {
          "text": "Human Resource",
          "link": "/backoffice/human-resource/overview",
          "collapsed": true,
          "items": [
            {
              "text": "Overview",
              "link": "/backoffice/human-resource/overview"
            },
            {
              "text": "Attendance",
              "link": "/backoffice/human-resource/attendance"
            }
          ]
        },
        {
          "text": "Report",
          "link": "/backoffice/report"
        },
        {
          "text": "IAM",
          "link": "/backoffice/admin/iam"
        },
        {
          "text": "Settings",
          "link": "/backoffice/admin/settings"
        },
        {
          "text": "Activity",
          "link": "/backoffice/admin/activity"
        }
      ]
    },
    {
      "text": "VSC POS",
      "collapsed": false,
      "items": [
        {
          "text": "Overview POS",
          "link": "/pos/overview"
        },
        {
          "text": "Login POS",
          "link": "/pos/login-pos"
        },
        {
          "text": "Session Cashier",
          "link": "/pos/session-cashier"
        },
        {
          "text": "Shift",
          "link": "/pos/shift"
        },
        {
          "text": "Table/Layout Order",
          "link": "/pos/table-layout-order"
        },
        {
          "text": "Start Order",
          "link": "/pos/start-order"
        },
        {
          "text": "Customer & Guest Info",
          "link": "/pos/customer-guest-info"
        },
        {
          "text": "Item, Condiment, Discount",
          "link": "/pos/item-condiment-discount"
        },
        {
          "text": "Payment",
          "link": "/pos/payment"
        },
        {
          "text": "Reprint Order",
          "link": "/pos/reprint-order"
        },
        {
          "text": "Browse Sale",
          "link": "/pos/browse-sale"
        },
        {
          "text": "Cancel/Void",
          "link": "/pos/cancel-void"
        },
        {
          "text": "Closing Cashier",
          "link": "/pos/closing-cashier"
        },
        {
          "text": "Stock",
          "link": "/pos/stock"
        },
        {
          "text": "Settings & Shortcut",
          "link": "/pos/settings-shortcut"
        },
        {
          "text": "Sold Out Item",
          "link": "/pos/sold-out-item"
        },
        {
          "text": "Incoming Order",
          "link": "/pos/incoming-order"
        },
        {
          "text": "Print QRCode",
          "link": "/pos/print-qrcode"
        }
      ]
    },
    {
      "text": "VSC KDS",
      "collapsed": false,
      "items": [
        {
          "text": "Overview KDS",
          "link": "/kds/overview"
        },
        {
          "text": "Login/Unlock KDS",
          "link": "/kds/login-unlock"
        },
        {
          "text": "Membaca Order Card",
          "link": "/kds/order-card"
        },
        {
          "text": "Memproses Pesanan",
          "link": "/kds/memproses-pesanan"
        },
        {
          "text": "Recall dan Logout",
          "link": "/kds/recall-logout"
        }
      ]
    },
    {
      "text": "VSC Order",
      "collapsed": false,
      "items": [
        {
          "text": "Overview Order",
          "link": "/order/overview"
        },
        {
          "text": "Scan QR Code",
          "link": "/order/scan-qr-code"
        },
        {
          "text": "Pilih Menu",
          "link": "/order/pilih-menu"
        },
        {
          "text": "Basket",
          "link": "/order/basket"
        },
        {
          "text": "Customer Info",
          "link": "/order/customer-info"
        },
        {
          "text": "Payment & QRIS",
          "link": "/order/payment-qris"
        },
        {
          "text": "Status Order",
          "link": "/order/status-order"
        },
        {
          "text": "Koneksi ke VSC POS",
          "link": "/order/koneksi-vsc-pos"
        }
      ]
    },
    {
      "text": "VSC Team",
      "collapsed": false,
      "items": [
        {
          "text": "Overview Team",
          "link": "/team/overview"
        },
        {
          "text": "Clock In",
          "link": "/team/clock-in"
        },
        {
          "text": "Clock Out",
          "link": "/team/clock-out"
        },
        {
          "text": "Attendance Summary",
          "link": "/team/attendance-summary"
        }
      ]
    }
  ],
  "search": {
    "provider": "local"
  },
  "outline": {
    "label": "Di halaman ini",
    "level": [
      2,
      3
    ]
  },
  "docFooter": {
    "prev": "Sebelumnya",
    "next": "Berikutnya"
  },
  "returnToTopLabel": "Kembali ke atas",
  "sidebarMenuLabel": "Menu",
  "darkModeSwitchLabel": "Tema",
  "lightModeSwitchTitle": "Beralih ke tema terang",
  "darkModeSwitchTitle": "Beralih ke tema gelap"
}

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.