Skip to content

$theme / useTheme()

Provides reactive access to the active OctoberCMS theme.

Use $theme inside Vue templates or useTheme() inside Composition API code.

Basic Usage

A generic type can describe custom values stored in the theme options as shown below.

vue
<template>
    <p>Theme: {{ $theme.name }}</p>
</template>

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

interface ThemeOptions {
    brandColor?: string;
}

const theme = useTheme<ThemeOptions>();
console.log(theme.value?.options.brandColor);
</script>

Theme Properties

The ref returned by useTheme() updates when the active LAIKA payload changes.

PropertyTypeDescription
namestring or nullTheme name.
descriptionstring or nullTheme description.
homepagestring or nullTheme homepage.
authorstring or nullTheme author.
authorCodestring or nullOctoberCMS author code.
codestring or nullTheme code.
optionsobjectCustom theme configuration values.

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