---
name: figma-use
description: Control Figma via CLI — create shapes, frames, text, components, set styles, layout, variables, export images. Use when asked to create/modify Figma designs or automate design tasks.
---
# figma-use
CLI for Figma. Two modes: commands and JSX.
```bash
# Commands
figma-use create frame --width 400 --height 300 --fill "#FFF" --layout VERTICAL --gap 16
figma-use create icon mdi:home --size 32 --color "#3B82F6"
figma-use set fill 1:23 "$Colors/Primary"
# JSX (props directly on elements, NOT style={{}})
echo '
Hello
' | figma-use render --stdin --x 100 --y 100
```
## Before You Start
```bash
figma-use status # Check connection
```
If not connected — start Figma with remote debugging:
```bash
# macOS
open -a Figma --args --remote-debugging-port=9222
# Windows
"C:\Users\%USERNAME%\AppData\Local\Figma\Figma.exe" --remote-debugging-port=9222
# Linux
figma --remote-debugging-port=9222
```
Start Figma with `--remote-debugging-port=9222` and you're ready.
## Two Modes
**Imperative** — single operations:
```bash
figma-use create frame --width 400 --height 300 --fill "#FFF" --radius 12
figma-use set fill "#FF0000"
figma-use node move --x 100 --y 200
```
**Declarative** — render JSX trees:
```bash
echo '
Title
Description
' | figma-use render --stdin --x 100 --y 200
```
stdin supports both pure JSX and full module syntax with imports:
```tsx
import { Frame, Text, defineComponent } from 'figma-use/render'
const Button = defineComponent(
'Button',
Click
)
export default () => (
)
```
**Elements:** `Frame`, `Rectangle`, `Ellipse`, `Text`, `Line`, `Arrow`, `Star`, `Polygon`, `Vector`, `Group`, `Icon`, `Image`, `Instance`
Use `` to create component instances:
```tsx
```
⚠️ **Always use `--x` and `--y`** to position renders. Don't stack everything at (0, 0).
## Interactions
Add and manage prototyping interactions on nodes:
```bash
figma-use interaction add --trigger ON_CLICK --action NAVIGATE --destination
figma-use interaction navigate --transition SMART_ANIMATE
figma-use interaction overlay --trigger ON_HOVER
figma-use interaction list
figma-use interaction remove --index 0
figma-use interaction remove --all
```
Triggers: `ON_CLICK`, `ON_HOVER`, `ON_PRESS`, `ON_DRAG`, `MOUSE_ENTER`, `MOUSE_LEAVE`, `AFTER_TIMEOUT`
Actions: `NAVIGATE`, `OVERLAY`, `SWAP`, `SCROLL_TO`, `CHANGE_TO`, `BACK`, `CLOSE`, `URL`
## Arrows
Create arrows with customizable start/end caps. Use `create arrow` command (not `create line`).
```bash
# Default arrow (end cap = arrow)
figma-use create arrow --x 100 --y 100 --length 200 --stroke "#000"
# Both ends with different caps
figma-use create arrow --x 100 --y 150 --length 200 --start-cap circle --end-cap arrow --stroke "#3B82F6" --stroke-weight 3
# Double arrow
figma-use create arrow --x 100 --y 200 --length 200 --start-cap arrow --end-cap arrow --stroke "#EF4444"
```
In JSX:
```tsx
```
**Cap values:** `none`, `round`, `square`, `arrow`, `arrow-lines`, `arrow-equilateral`, `triangle`, `diamond`, `circle`
Note: `create line` creates a pure Line node without arrow caps.
## Icons
150k+ icons from Iconify by name:
```bash
figma-use create icon mdi:home
figma-use create icon lucide:star --size 48 --color "#F59E0B"
figma-use create icon heroicons:bell-solid --component # as Figma component
```
In JSX:
```tsx
```
## Images
Create image nodes from URL, local file, or data URI:
```bash
figma-use create image https://example.com/photo.jpg --x 100 --y 200
figma-use create image ./screenshot.png --name "Reference"
figma-use create image ./photo.jpg --width 400 --height 300 --scale fit --radius 12
```
Auto-detects native image dimensions. Supports `--scale` modes: `fill`, `fit`, `crop`, `tile`.
In JSX:
```tsx
```
## Charts
Create charts with d3-based commands:
```bash
figma-use create chart scatter --data "10:20,30:40,50:60" --x-label "X" --y-label "Y"
figma-use create chart bubble --data "10:20:30,40:50:20,60:30:50" --max-radius 50
```
Data formats:
- Scatter: `x:y,...` (optional `label:x:y`)
- Bubble: `x:y:size,...` (optional `label:x:y:size`)
## Export JSX
Convert Figma nodes back to JSX code:
```bash
figma-use export jsx # Minified
figma-use export jsx --pretty # Formatted
# Format options
figma-use export jsx --pretty --semi --tabs
# Match vector shapes to Iconify icons (requires: npm i whaticon)
figma-use export jsx --match-icons
figma-use export jsx --match-icons --icon-threshold 0.85 --prefer-icons lucide,tabler
```
Round-trip workflow:
```bash
# Export → edit → re-render
figma-use export jsx --pretty > component.tsx
# ... edit the file ...
figma-use render component.tsx --x 500 --y 0
```
Compare two nodes as JSX:
```bash
figma-use diff jsx
```
## Export Storybook (Experimental)
Export all components on current page as Storybook stories:
```bash
ffigma-use export storybook # Output to ./stories/
ffigma-use export storybook --out ./src/stories # Custom output dir
ffigma-use export storybook --match-icons # Match vectors to Iconify icons
ffigma-use export storybook --no-semantic-html # Disable semantic HTML conversion
```
**Semantic HTML:** By default, components are converted to semantic HTML elements based on their names:
- `Input/*`, `TextField/*` → ``
- `Textarea/*` → `