--- name: propkit description: Guides creation and refinement of Figma-style property panel patterns ("PropKit") using FigUI3 components. Applies when building or modifying property fields in the playground app (`/propkit` route), generating consistent field prompts, composing horizontal `fig-field` rows, or tuning panel UX for controls like image, color, fill, slider, switch, dropdown, segmented control, easing, and angle. user-invocable: false --- # PropKit Patterns for composing clean, production-ready Figma property panels with FigUI3. > IMPORTANT: Favor composition and consistency over custom one-off controls. Build panels from existing `fig-*` elements first. ## Current Project Context ```json !`node -e "const fs=require('fs'); const ok=fs.existsSync('playground/src/main.tsx'); console.log(JSON.stringify({playground:ok, route:'/propkit', example:'horizontal fig-field + label + fig-* control'},null,2))" 2>/dev/null || echo '{"error":"context unavailable"}'` ``` ## Principles 1. **Use horizontal property rows by default.** PropKit fields are primarily `fig-field direction="horizontal"`. 2. **One clear label per control.** Keep labels concise and aligned with Figma property language. 3. **Prefer native FigUI3 controls.** Use `fig-input-fill`, `fig-slider`, `fig-dropdown`, `fig-switch`, etc. 4. **Use realistic panel widths and spacing.** Match the property panel feel (`~240px` panel blocks in demos). 5. **Keep prompts and examples deterministic.** Prompt text should describe exact structure and key attributes. ## React + Vite PropKit Usage ### Include FigUI3 in React projects - Import once in app bootstrap: - `import "@rogieking/figui3/fig.css";` - `await import("@rogieking/figui3/fig.js");` - Register components before first React render to avoid undefined custom elements. - Keep this setup in entry files (`main.tsx` / `main.jsx`), not scattered across feature components. ### Vite setup and tree-shaking behavior - Base Vite React config is sufficient in most cases: ```ts import { defineConfig } from "vite"; import react from "@vitejs/plugin-react"; export default defineConfig({ plugins: [react()], }); ``` - In production, FigUI3 side-effect registration can be tree-shaken if only imported for side effects. - Preferred pattern (from `webgpu-effects`) is explicit async bootstrap: ```tsx import "@rogieking/figui3/fig.css"; const bootstrap = async () => { await import("@rogieking/figui3/fig.js"); createRoot(document.getElementById("app")!).render(); }; bootstrap(); ``` ### React composition conventions for PropKit rows - Continue using canonical row shape in JSX: - `` + `