Skip to content

<ServerPartial />

Loads and renders an OctoberCMS partial on the server.

The <ServerPartial /> component requests a theme partial from OctoberCMS and inserts the returned HTML into the current Vue page. It reloads automatically when the partial name or its parameters change.

WARNING

Partial output is inserted using innerHTML. Only render partials and parameters trusted by your OctoberCMS application.

Basic Usage

vue
<template>
    <ServerPartial name="site/footer" />
</template>

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

Pass values to the partial using the parameters property.

vue
<ServerPartial
    name="blog/post-card"
    :parameters="{ post }"
/>

Available Properties

PropertyTypeDefaultDescription
namestringRequired OctoberCMS partial name.
parametersobject{}Values made available while rendering the partial.
tagstringdivHTML element used to contain the rendered partial.

Parameter changes are observed deeply, so updating a value inside a reactive parameters object reloads the partial.

Rendering State

The generated element includes attributes that can be used for styling or status handling.

AttributeDescription
data-laika-partialContains the requested partial name.
data-loading="true"Present while the partial is being loaded.
data-errorContains the request error message when rendering fails.
css
[data-laika-partial][data-loading="true"] {
    opacity: 0.5;
}

When a partial is refreshed, its previous HTML remains visible until the new request completes. The component does not provide slots.

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