Skip to content

$payload / usePayload()

Provides reactive access to the complete LAIKA payload.

$payload exposes the current payload inside Vue templates. usePayload() returns a computed ref for each top-level payload section.

NOTE

Use useSite(), useTheme(), usePage() or useShared() when only one payload section is needed.

Basic Usage

vue
<template>
    <h1>{{ $payload?.page.title }}</h1>
</template>

<script lang="ts" setup>
import { usePayload } from '@ratmd/laika';

const { page, site, shared } = usePayload();

console.log(page.value?.title);
console.log(site.value?.locale);
console.log(shared.value);
</script>

Payload Sections

All values returned by usePayload() are computed refs and update when LAIKA swaps or patches the payload.

PropertyDescription
versionServer-provided payload version.
tokenCombined CSRF and LAIKA request token.
siteActive OctoberCMS site configuration.
themeActive theme metadata and options.
pageCurrent page metadata, properties and rendered content.
componentsOctoberCMS components registered on the current layout and page.
octoberOctoberCMS URLs, routes, localization data and runtime configuration.
sharedApplication values shared with the current page.

This software is not an official OctoberCMS product and is not associated with, sponsored by, or endorsed by OctoberCMS.