Your own components
Define your own components with the same model as the Engine's: a contract and a design, as data, in your own namespace. The CLI generates their CSS and adds them to your project's manifest, the Figma plugin syncs them, and agents can use them in specs.
The contract
The contract says what the component accepts. Its id is namespace.name, and the namespace is yours: acme below. The engine namespace is the Engine's own.
// src/acme/notice.contract.ts
import { defineContract, prop } from "@uiuxengine/core";
export const noticeContract = defineContract({
id: "acme.notice",
name: "notice",
version: "1.0.0",
description: "A one-line status message.",
props: { message: prop.text({ required: true }) },
semantics: { role: "status" },
});Props are enum, boolean, text or number. Slots are icon or content, for other components. Contracts also declare the state a component holds, such as a select's value, events with their payloads, accessibility semantics and constraints such as "one of these props is required". From the contract come the TypeScript props, a JSON Schema and validation.
The design
The design says how it looks: a tree of parts with a layout, bound to tokens, and rules for variants and states.
// src/acme/notice.design.ts
import { defineDesign } from "@uiuxengine/core";
import { token } from "@uiuxengine/tokens";
export const noticeDesign = defineDesign({
component: "acme.notice",
axes: [],
states: {},
root: {
id: "root",
kind: "frame",
layout: { direction: "horizontal", padding: { x: token("control.padding-x.md") } },
style: { fill: token("color.bg.surface"), foreground: token("color.fg.default") },
children: [
{
id: "message",
kind: "text",
content: { prop: "message" },
placeholder: "Saved",
style: { typography: token("text.body.md") },
},
],
},
rules: [],
});The layout vocabulary, direction, alignment, gap, padding and sizing, maps to both flexbox and Figma auto layout. Both files are plain data: no functions, classes or framework code. The Button's contract and design show variants, sizes, states and icon slots.
Register the set
Your components form a definition set. Add it to engine.config.ts:
import { defineConfig } from "@uiuxengine/cli";
import { noticeContract } from "./src/acme/notice.contract.ts";
import { noticeDesign } from "./src/acme/notice.design.ts";
export default defineConfig({
sets: [{ namespace: "acme", components: [{ contract: noticeContract, design: noticeDesign }] }],
});Then generate:
npx @uiuxengine/cli generateYour component's CSS lands in src/engine/engine.css, with the class ue-acme_notice, and its entry in engine.manifest.json. generate refuses a component outside its set's namespace and two components with the same id, so two publishers never collide.
The React component
useComponent applies the contract's defaults, checks props in development and gives the root element its class, data attributes and ARIA role. renderParts renders the design's parts:
// src/acme/notice.tsx
import type { InferProps } from "@uiuxengine/core";
import { renderParts, useComponent } from "@uiuxengine/react";
import { noticeContract } from "./notice.contract.ts";
import { noticeDesign } from "./notice.design.ts";
export function Notice({ message }: InferProps<typeof noticeContract>) {
const { props, rootProps } = useComponent(noticeContract, noticeDesign, { message });
return (
<div {...rootProps}>
{renderParts(noticeDesign, { props }, { text: () => props.message, icon: () => null })}
</div>
);
}To let specs use it, register it with defineReactComponent and pass it to SpecRenderer, as in Agents and MCP.
Sync to Figma
npx @uiuxengine/cli figma includes your sets, so your components sync next to the Engine's, as native component sets bound to the same variables. See Figma.
Publishing components
A set can live in its own npm package and be imported into engine.config.ts like a local one. To ship components as editable source instead, publish them as blocks in a registry of your own: see Blocks. Use your own namespace and name, never engine or the UI/UX Engine name.