ワンクリックで
ui-component-generation
Generate multi-file React component bundles with design tokens from natural language descriptions.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Generate multi-file React component bundles with design tokens from natural language descriptions.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
How authenticated HTTP calls to the Opal backend work — the host/guest architecture, fetchWithCreds, the fetch allowlist, and the OpalBackendClient migration. Read this before adding, modifying, or debugging any backend call.
Learn how to make widgets on canvas
Produce high-quality React apps from natural language descriptions.
Teaches you how to properly operate in the sandboxed environment you're in.
Learn how to present your work as a structured surface — a curated manifest of artifacts that the user's application renders in real time.
Learn how to use `window.opalSDK` inside your sandboxed React component to read files, call host services, and listen for events from the application.
| name | UI Component Generation |
| description | Generate multi-file React component bundles with design tokens from natural language descriptions. |
You are now acquiring the skill of generating React UI components. After reading this document, you will know how to produce high-quality, multi-file React component bundles from natural language descriptions.
--cg- design
tokens. No hex colors, no rgb(), no named colors, no raw pixel values.
Hardcoded values like #8B6F47 or color: olive break the live theme
switcher. This is a build error, not a suggestion./images/property-1.png. These are real files. Use them as-is in
<img> tags. Never substitute with Unsplash, placeholder, or invented
URLs.You are generating a static React component bundle with no backend, no external API calls, and no dynamic data fetching. This means:
@widgets/Map, @widgets/ScoreBar, @widgets/StarRating) — they
handle rendering and API access internally.fetch() or XMLHttpRequest. The iframe is sandboxed. All data
must come from the prompt and be embedded in the component.These are common CSS patterns that look generic and templated. Avoid all of them:
border-left: 3px solid ... on
blockquotes, callouts, or commentary sections. This is the most overused
"AI-generated UI" pattern. Instead, use subtle background tints or
var(--cg-card-bg) with extra padding.text-transform: uppercase; letter-spacing: 2px for section headers like "COMMUTE" or "SCHOOLS".
Use normal sentence-case var(--cg-text-label-md-size) labels.linear-gradient(rgba(0,0,0,...)) overlays.--cg-color-secondary and
--cg-color-secondary-container — for badges, highlights,
attention-drawing elements.--cg-color-tertiary and
--cg-color-tertiary-container — for progress bars, score
indicators, and complementary accents.
A page that is entirely grey/beige is a failure. Use accents to create
visual rhythm and draw the eye to what matters.These are pre-built React components available via require("@widgets/...").
They are real, working implementations — do not reimplement them yourself.
Use when appropriate based on the user's context.
const Map = require("@widgets/Map").default;
| Prop | Type | Description |
|---|---|---|
center | [lat, lng] | Map center coordinates |
markers | { lat, lng, label? }[] | Pins to display |
zoom | number (default: 13) | Initial zoom level |
height | string (default: "200px") | CSS height |
Use when location context would be helpful. Placement rules:
const ScoreBar = require("@widgets/ScoreBar").default;
| Prop | Type | Description |
|---|---|---|
value | number | Current score |
max | number (default: 10) | Maximum score |
label | string | Label text (e.g. "Safety") |
showValue | boolean (default: true) | Show numeric value |
Use for numeric metrics like walkability, safety, and school ratings.
const StarRating = require("@widgets/StarRating").default;
| Prop | Type | Description |
|---|---|---|
rating | number | Rating value (supports halves) |
max | number (default: 5) | Maximum stars |
size | number (default: 18) | Star size in pixels |
Use for overall property ratings, school ratings, or neighbourhood quality scores.
Not every generation needs widgets. Only use a widget when the user's context gives you a concrete reason to.
A multi-file React component bundle rendered in a sandboxed iframe. The bundle consists of:
App.jsx — the root component that accepts configuration propscomponents/*.jsx — reusable sub-componentsstyles.css — shared styles using CSS custom propertiesComponents use inline styles with CSS custom properties from a design token system. Import resolution between files is handled automatically by the build pipeline.
Before writing code, output a brief <thinking> block (max 3–4 sentences)
explaining your approach: what layout you'll use, which properties you'll
highlight, and how the personal context informed your choices. This block
will be shown to the user while the code generates.
Then return each file in a fenced code block with the filename as the language identifier:
```App.jsx
// ... code ...
```
```styles.css
/* ... styles ... */
```
```components/ScoreCard.jsx
// ... code ...
```
App.jsx and
contain a function called App.App
with realistic defaults.components/ should
render standalone with sensible defaults. Document all props with @prop
JSDoc.import React from "react" in
every JSX file. Import sub-components with relative paths (e.g.
import Header from "./components/Header").import "./styles.css" in App.jsx for shared
styles.export default its component
function.When creating a component, think about what data the caller would want to
customize. These become props on App:
| UI Type | Example Props |
|---|---|
| Weather dashboard | location, temperature, condition, forecast (array) |
| User profile | name, avatar, bio, stats (object) |
| Product card | title, price, image, rating, reviews |
| Task manager | tasks (array), categories, user |
| Analytics dashboard | metrics (array), timeRange, chartData |
All props MUST have realistic default values so the component renders standalone with zero configuration.
Reminder: this is a hard rule (see above). Every visual value — colors,
spacing, type, radii, shadows — MUST use --cg- tokens. No exceptions.
| Category | Use | Never |
|---|---|---|
| Colors | var(--cg-color-...) | #hex, rgb(), named colors |
| Spacing | var(--cg-sp-...) | Raw pixel values for padding/margin/gap |
| Font sizes | var(--cg-text-...-size) | 14px, 1rem |
| Border radius | var(--cg-radius-...) or var(--cg-card-radius) | 12px, 24px |
| Shadows | var(--cg-elevation-...) or var(--cg-card-shadow) | Raw box-shadow values |
| Font family | var(--cg-font-sans) or var(--cg-font-mono) | 'Arial', sans-serif |
Colors: --cg-color-surface-dim, --cg-color-surface,
--cg-color-surface-bright, --cg-color-surface-container-lowest,
--cg-color-surface-container-low, --cg-color-surface-container,
--cg-color-surface-container-high, --cg-color-surface-container-highest,
--cg-color-on-surface, --cg-color-on-surface-muted, --cg-color-primary,
--cg-color-primary-container, --cg-color-on-primary,
--cg-color-on-primary-container, --cg-color-secondary,
--cg-color-secondary-container, --cg-color-on-secondary,
--cg-color-on-secondary-container, --cg-color-tertiary,
--cg-color-tertiary-container, --cg-color-on-tertiary,
--cg-color-on-tertiary-container, --cg-color-error,
--cg-color-error-container, --cg-color-on-error,
--cg-color-on-error-container, --cg-color-outline,
--cg-color-outline-variant
Typography: --cg-font-sans, --cg-font-mono,
--cg-text-display-{lg,md,sm}-{size,line-height,weight},
--cg-text-headline-{lg,md,sm}-{size,line-height,weight},
--cg-text-title-{lg,md,sm}-{size,line-height,weight},
--cg-text-body-{lg,md,sm}-{size,line-height,weight},
--cg-text-label-{lg,md,sm}-{size,line-height,weight}
Spacing (4px grid): --cg-sp-0 through --cg-sp-16
Radius: --cg-radius-{xs,sm,md,lg,xl,full}
Elevation: --cg-elevation-{1,2,3}
Motion: --cg-motion-duration-{short,medium,long},
--cg-motion-easing-{standard,decel,accel}
Component tokens: Card: --cg-card-{bg,radius,padding,shadow}, Button:
--cg-button-{radius,padding,bg,color,font-size,font-weight}, Input:
--cg-input-{bg,border,radius,padding,color,placeholder}, Badge:
--cg-badge-{bg,color,radius,padding,font-size}, Divider:
--cg-divider-{color,thickness,style}
Expressive: --cg-border-{style,width},
--cg-heading-{transform,letter-spacing},
--cg-img-{radius,border,shadow,filter}, --cg-hover-{scale,brightness,shadow}
Header,
MetricsGrid, ForecastCard, etc.Google Material Symbols Outlined is available:
<span className="material-symbols-outlined" style={{ fontSize: "20px" }}>
search
</span>
Components should be interactive where appropriate. Use useState, useEffect
with cleanup. Supported patterns: timers, carousels, accordions, tabs,
checklists, toggles.
Never use Date.now(), Math.random(), or new Date() in default parameters.
Compute once at module level or use useState(() => ...).
This is the most important section. The depth and richness of your output must be proportional to the personal context provided.
The right components and integrations should EMERGE from the intersection of the task objective and the personal context. The user does not declare which components to include — you determine what's needed based on what the context actually says.
Emergence requires evidence. Every component, score, integration, and editorial comment must be JUSTIFIED by something in the provided context. If the context doesn't mention it, the UI shouldn't include it.
When the context warrants it, consider these rich component patterns:
React, useState, useEffect, useRef, useCallback, useMemo,
useContext, useReducer, useLayoutEffect, memo, forwardRef,
createContext, Fragment
Generate realistic, plausible sample data — no "Lorem ipsum". Be creative and visually impressive.