DevelopersAngular

Angular SDK

Embed published RuleCMS widgets in Angular

Keep the Angular app you already run. Marketers compose in RuleCMS, you publish with environment tokens, and @rulecms/widget-angular renders the default component set.

Getting started guide

Install and embed

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

install.shBash
npm install @rulecms/widget-angular @rulecms/source-components-angular
homepage-hero.component.tsTS
import { Component } from "@angular/core";import { RuleCMSWidgetComponent } from "@rulecms/widget-angular";@Component({  selector: "homepage-hero",  imports: [RuleCMSWidgetComponent],  template: `    <rulecms-widget      [publishedKey]="publishedKey"    />  `,})export class HomepageHero {  publishedKey = "your-widget-key";}

Angular is a first-class host app

The CMS journey does not require a React frontend.

If your product is Angular — or Angular on the admin shell and something else on the marketing site — you can still buy RuleCMS and keep that architecture. Editors get the visual composer, device preview, staging, and production. You get a standalone widget component, a provider for the token and libraries, and the same published keys every other SDK uses.

What Angular renders today is the default RuleCMS card set: text, images, video, icons, buttons, dividers, embeds, lists, and accordions. That covers a long customer journey — campaigns, FAQs, studio pages, and calls to action — without asking you to rewrite the host app. Custom design-system registration in the composer is the React-only depth; the rest of the product is yours on Angular.

Provider, libraries, and the widget

The widget package fetches and lays out. The source-components package paints the cards.

Install both packages. Register @rulecms/source-components-angular as the default library. Wrap the tree with rulecms-widget-provider so every widget on the page shares the token. Peer dependencies are Angular 17 or newer.

homepage-hero.component.tsTS
import { Component } from "@angular/core";import {  RuleCMSWidgetComponent,  RuleCMSWidgetProviderComponent,} from "@rulecms/widget-angular";import * as sourceComponents from "@rulecms/source-components-angular";@Component({  standalone: true,  imports: [RuleCMSWidgetProviderComponent, RuleCMSWidgetComponent],  template: `    <rulecms-widget-provider [token]="token" [libraries]="libraries">      <rulecms-widget        [publishedKey]="publishedKey"        [componentProps]="componentProps"      />    </rulecms-widget-provider>  `,})export class HomepageHero {  token = "your-environment-token";  publishedKey = "your-widget-key";  libraries = { default: sourceComponents };  componentProps = {    "b721c4e2-…": { onClick: (event: Event) => console.log("cta", event) },  };}

Environments, keys, and pre-fetched HTML

Same routing rules as the React SDK.

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

Fetch on the server (or at build time), then render with mode="pre-fetched" so images and copy are in the first HTML. The client does not refetch and does not need the token. Pre-fetched mode uses CSS breakpoint variants so the server HTML matches every viewport.

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

Token setup: projects, environments, and tokens.

Host click handlers

A published button should call into your Angular app.

Pass componentProps keyed by the column id the composer shows. A bare id matches every copy of a repeated collection. A path of enclosing collection columns targets one embedding. r-button reads onClick. The renderer never inspects the bag. In development, a key that addresses no column prints once.

The public Angular sample lab is a teaching project: clone it to see the provider wiring, not to fork a production app.

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.

Angular sample lab

Standalone components, the widget provider, and a published widget on a demo page.

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 Angular with RuleCMS

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