DevelopersVue

Vue SDK

Embed published RuleCMS widgets in Vue

Vue 3 and Nuxt hosts use @rulecms/widget-vue plus the default card library. Compose in RuleCMS, publish with a scoped token, and drop the widget into a single-file component.

Getting started guide

Install and embed

Add @rulecms/widget-vue and render a published widget.

install.shBash
npm install @rulecms/widget-vue @rulecms/source-components-vue
HomepageHero.vueTS
<script setup>import { RuleCMSWidget } from "@rulecms/widget-vue";const publishedKey = "your-widget-key";</script><template>  <RuleCMSWidget :published-key="publishedKey" /></template>

Vue teams keep their stack

The composer does not care that the storefront is Vue.

A Vue app is a complete RuleCMS customer. Editors still build heroes and landing blocks in the visual composer, preview phone through desktop, and promote from staging to production. You install two packages, register the default cards, and render RuleCMSWidget. Peer dependency: Vue 3.3 or newer.

The Vue SDK ships the default RuleCMS components — text, images, video, icons, buttons, dividers, embeds, lists, and accordions. That is enough to run the customer journey without a React rewrite. If you later want the composer to host a custom design system, that registration path is documented on the React guide. You do not need it to start, or to stay on Vue.

Provider and widget

One provider per tree. As many widgets as the page needs.

@rulecms/widget-vue fetches and lays out the item tree. @rulecms/source-components-vue is the default library you pass in. Without that registration, the layout has nowhere to paint cards.

HomepageHero.vueTS
<script setup>import { RuleCMSWidget, RuleCMSWidgetProvider } from "@rulecms/widget-vue";import * as sourceComponents from "@rulecms/source-components-vue";const token = "your-environment-token";const publishedKey = "your-widget-key";const libraries = { default: sourceComponents };const componentProps = {  "b721c4e2-…": { onClick: (event) => console.log("cta", event) },};</script><template>  <RuleCMSWidgetProvider :token="token" :libraries="libraries">    <RuleCMSWidget      :published-key="publishedKey"      :component-props="componentProps"    />  </RuleCMSWidgetProvider></template>

Tokens, drafts, and pre-fetched HTML

Same environment rules as every official SDK.

  • Staging and production: plain token + environmentId---widget-… published key.
  • Development: dev. token + draft widget key for live drafts.

For SSR or SSG, fetch with fetchRuleCMSWidget and render mode="pre-fetched". The browser does not refetch and does not need the token. Breakpoint variants keep the server HTML honest across viewports.

fetch-widget.tsTS
import { fetchRuleCMSWidget } from "@rulecms/widget-vue";const data = await fetchRuleCMSWidget({  publishedKey: process.env.RULECMS_PUBLISHED_KEY,  token: process.env.RULECMS_TOKEN,});

Credentials live in project settings. The Vue sample lab is a public teaching project with a live demo — use it to see the wiring, not as a production template.

Host-app callbacks

Pass componentProps by column id so an r-button can open a Vue drawer or hit your router. Bare ids apply to every copy of a repeated collection; a / path targets one embedding. Longest match wins. In development, a dead key logs once so you can fix the id before you publish.

Packages

Install from the public registry. These are the supported SDK surfaces — not GitHub source repos.

Sample labs

Public teaching projects that show the integration pattern. Copy the wiring, not the app architecture — they are not production starters.

Vue sample lab

Vite + Vue 3 lab that registers the default cards and renders a widget.

Need the product docs for tokens, widgets, or the headless API? Start at Getting started, then environments and tokens and the API reference.

Other SDKs

Same published widgets and environment tokens. Pick the guide for the stack you ship.

Explore RuleCMS

Dive deeper into what makes RuleCMS different.

Ship Vue with RuleCMS

Create a project, provision three environments, and copy a scoped API token.