Your own components
On this page
Build components the studio does not have, keep them in your library, and use them like built-in ones: on the canvas, in previews, exported apps, Run in Pega and components published into Pega.
Make one
Components panel → Library tab → New component. Three ways to start:
- Build with AI: describe it ("a KPI tile with a label, a big number, a trend arrow and a small bar"). Claude writes the component; Change with AI refines it ("make the number smaller, add a target line"). Uses your AI key.
- Import an HTML or SVG file, or a component package (
.json) someone shared. - Write the template yourself.
A component is a template: HTML or SVG with {{key}} placeholders, plus settings that designers change in
Properties:
| Setting type | What designers set |
|---|---|
| Text, Number, Yes/No, Choice | The value |
| Colour | A theme colour (follows the theme, light and dark) |
| Pega property | A property path; the placed component shows that property's value from the case |
The preview shows it in the design's theme as you type.
React components
Choose React code in the dialog for a component that reacts to clicks, typing or time (a counter, a calculator, a step-by-step helper). Write one TSX file:
import * as React from 'react';
import type { StudioComponentProps } from './studio-component';
export default function Component({ settings, value, set }: StudioComponentProps) {
// settings: what designers set; value / set: the first "Pega property" setting; theme: the design's colours
…
}
- Only
reactmay be imported, and only React 18 features (Pega builds published components with React 18). - Not allowed: network calls, browser storage or cookies, other windows or navigation, raw HTML
(
dangerouslySetInnerHTML,innerHTML),evalornew Function, fixed colours or fonts (usevar(--studio-…)). - It runs isolated: in the studio, the code runs in a sandboxed frame with no access to the studio, your sign-in or your Pega session, and that frame may not connect anywhere. The preview shows it live; Runs in the sandbox is one of the checks.
- In exported apps it is its own file (
src/custom/Custom….tsx); in a published Pega template, Pega's own component builder compiles it, and its Pega property is bound in App Studio like a field. The runner (Run in Pega's Constellation preview) does not run component code and shows a note instead. - Build with AI writes React code too when React code is selected.
The checks
The studio checks every component, and the checks decide whether it can be used in Pega (the badge Pega + apps, or Needs changes):
- Safe markup: only plain HTML/SVG; no scripts, event handlers, frames, style blocks or addresses other than https. The studio redraws the markup from an allow-list, so nothing else can get through; Keep only the safe markup removes what is not allowed.
- Follows the theme: no fixed colours or fonts. Each fixed colour comes with a suggested theme colour and a
one-click fix (for example
#7c3aed→ the theme's primary). Fonts come from the design. - Settings: every
{{key}}has a setting (Add settings for … creates them). - Accessibility: images have alt text; drawings have a label or are marked as decoration.
- Renders with its sample values.
AI review explains the results in plain language and how to fix them. The AI explains; the checks decide. Fix with AI (shown when a check fails) sends the failed checks to the AI and asks it to fix only those, the way Pega's component kit works (build, check, fix). The component is replaced and the checks run again: review them, then save. A secret check also fails components that contain keys, tokens or passwords. Uses your AI key.
Approval and who may do what
| Owner | Publisher | Developer | Viewer | |
|---|---|---|---|---|
| Make, import or AI-build a component; use own drafts | ✓ | ✓ | ✓ | |
| Submit a draft for the team (checks must pass) | ✓ | ✓ | ✓ | |
| Approve, or ask for changes with a note | ✓ | |||
| Use approved components | ✓ | ✓ | ✓ | view |
| Publish designs with your own components to Pega | ✓ | ✓ |
- In a team, the owner approves. The approved version is frozen and stays in use while a newer draft is reviewed; designs show Update to approved version N when a newer one is approved.
- The owner makes a developer a Publisher in Account → the team's members.
- Drafts never go into Pega. Publish to Pega, DX component export and case-flow publishing refuse a design with a draft. Online, the publisher also checks on the server that every component in the bundle is an approved version in your space and that you may publish it.
- In your personal space (or on this device only) you are the owner: approve your own component once its checks pass.
In Pega
A component published inside a FORM template is drawn by the same safe renderer. Each Pega property setting becomes a template setting in App Studio ("@P .Property", bound like a field), so the component shows the case's value.
Limits
- Templates draw; they do not react to clicks or time: use a React component (or the built-in timer, SLA countdown, signature and ranking).
- Pega's own controls keep Pega's theme; your components follow the design's theme everywhere.