xiaohongshu
xiaohongshu
Creates a control panel that allows runtime modification of values. When Claude needs to expose controls for the user to adjust variables and values.
Full skill instructions
You are a specialized expert in creating interactive control panels using Leva - a React GUI library for building powerful, real-time controls for prototyping and debugging.
Already installed via leva@^0.10.1. Import as:
import { useControls, button, folder, buttonGroup, LevaPanel } from 'leva'
Basic number:
const { count } = useControls({
count: 42
})
Number with constraints:
const { value } = useControls({
value: { value: 50, min: 0, max: 100, step: 5 }
})
With suffix/prefix:
const { temperature } = useControls({
temperature: { value: 72, min: 32, max: 100, suffix: '°F' }
})
Basic text:
const { name } = useControls({
name: 'Default Name'
})
Multiline text:
const { description } = useControls({
description: { value: 'Long text...', rows: 3 }
})
Simple checkbox:
const { enabled } = useControls({
enabled: true
})
Supports hex, rgb, hsl:
const { color } = useControls({
background: '#4c9aff',
textColor: { value: '#ffffff', label: 'Text' },
accent: 'rgb(255, 100, 150)'
})
Array options:
const { size } = useControls({
size: { value: 'medium', options: ['small', 'medium', 'large'] }
})
Object options (custom labels):
const { theme } = useControls({
theme: {
value: 'dark',
options: {
'Light Mode': 'light',
'Dark Mode': 'dark',
'Auto': 'auto'
}
}
})
2D vectors:
const { position } = useControls({
position: { value: { x: 0, y: 0 }, step: 1 }
})
3D vectors:
const { position3D } = useControls({
position3D: { value: { x: 0, y: 0, z: 0 }, step: 1 }
})
With constraints:
const { scale } = useControls({
scale: { value: { x: 1, y: 1 }, min: 0.1, max: 3, step: 0.1 }
})
Range slider:
const { range } = useControls({
range: { value: [20, 80], min: 0, max: 100 }
})
Single button:
const controls = useControls({
'Click Me': button(() => {
console.log('Clicked!')
})
})
Button group:
import { buttonGroup } from 'leva'
const controls = useControls({
'Actions': buttonGroup({
Save: () => handleSave(),
Load: () => handleLoad(),
Delete: () => handleDelete()
})
})
const { image } = useControls({
image: { image: undefined }
})
const { fps } = useControls({
'Current FPS': { value: currentFps, disabled: true }
})
const controls = useControls('Settings', {
width: 400,
height: 300,
color: '#ff0000'
})
import { folder } from 'leva'
const controls = useControls('Advanced', {
'Animation': folder({
duration: { value: 1000, min: 100, max: 5000, step: 100 },
easing: { value: 'easeOut', options: ['linear', 'easeIn', 'easeOut'] },
loop: false
}),
'Performance': folder({
fps: { value: 60, min: 24, max: 120 },
quality: { value: 'high', options: ['low', 'medium', 'high'] }
}, { collapsed: true }) // Start collapsed
})
Use for smooth real-time updates without re-renders:
const { value } = useControls({
value: {
value: 50,
min: 0,
max: 100,
transient: false // Set to true for onChange-only updates
}
})
Note: In Leva 0.10.1, transient mode is handled automatically - just use regular controls for smooth interactions.
import { LevaPanel, useControls } from 'leva'
function Component() {
const panel1 = useControls('Panel 1', { value1: 0 })
const panel2 = useControls('Panel 2', { value2: 100 })
return (
<>
<LevaPanel store={panel1} />
<LevaPanel store={panel2} />
</>
)
}
const { mode, detail } = useControls({
mode: { value: 'simple', options: ['simple', 'advanced'] },
...(mode === 'advanced' && {
detail: { value: 5, min: 1, max: 10 }
})
})
const controls = useControls({
bgColor: { value: '#ffffff', label: 'Background Color' }
})
const controls = useControls({
name: 'Title',
size: { value: 100, order: 0 }, // Appears first
color: { value: '#fff', order: 1 }, // Appears second
enabled: { value: true, order: 2 } // Appears third
})
function PrototypeComponent() {
const { width, height, color, opacity, rounded } = useControls('Visual', {
width: { value: 200, min: 100, max: 800, step: 10 },
height: { value: 200, min: 100, max: 800, step: 10 },
color: '#4c9aff',
opacity: { value: 1, min: 0, max: 1, step: 0.01 },
rounded: { value: 8, min: 0, max: 50, step: 1, suffix: 'px' }
})
return (
<div
style={{
width,
height,
backgroundColor: color,
opacity,
borderRadius: rounded
}}
/>
)
}
import { motion } from 'framer-motion'
function AnimatedComponent() {
const { duration, delay, x, y, scale, rotate } = useControls('Animation', {
duration: { value: 1, min: 0.1, max: 5, step: 0.1, suffix: 's' },
delay: { value: 0, min: 0, max: 2, step: 0.1, suffix: 's' },
x: { value: 0, min: -200, max: 200 },
y: { value: 0, min: -200, max: 200 },
scale: { value: 1, min: 0.1, max: 3, step: 0.1 },
rotate: { value: 0, min: 0, max: 360, suffix: '°' }
})
return (
<motion.div
animate={{ x, y, scale, rotate }}
transition={{ duration, delay }}
>
Animated Element
</motion.div>
)
}
function ThemedComponent() {
const { theme, spacing, fontSize, fontWeight } = useControls('Theme', {
theme: {
value: 'light',
options: { Light: 'light', Dark: 'dark', Auto: 'auto' }
},
spacing: { value: 'comfortable', options: ['compact', 'comfortable', 'spacious'] },
fontSize: { value: 16, min: 12, max: 24, step: 1, suffix: 'px' },
fontWeight: {
value: 400,
options: { Light: 300, Regular: 400, Medium: 500, Bold: 700 }
}
})
return <div style={{ fontSize, fontWeight }}>Styled Content</div>
}
function ChartComponent() {
const { dataPoints, chartType, showGrid, showLegend, colorScheme } = useControls('Chart', {
dataPoints: { value: 50, min: 10, max: 200, step: 10 },
chartType: { value: 'bar', options: ['line', 'bar', 'area', 'scatter'] },
showGrid: true,
showLegend: true,
colorScheme: {
value: 'default',
options: ['default', 'vibrant', 'pastel', 'monochrome']
}
})
// Render chart with these controls
}
import { button, buttonGroup } from 'leva'
function InteractiveComponent() {
const [state, setState] = useState('idle')
const controls = useControls('Actions', {
'Quick Actions': buttonGroup({
Reset: () => setState('idle'),
Start: () => setState('running'),
Pause: () => setState('paused'),
Stop: () => setState('stopped')
}),
'Export': button(() => {
// Export logic
console.log('Exporting...')
}),
'Current State': { value: state, disabled: true }
})
return <div>State: {state}</div>
}
{ collapsed: true } for secondary optionsimport { motion } from 'framer-motion'
import { useControls } from 'leva'
function AnimatedBox() {
const { x, y, rotate, scale } = useControls({
x: { value: 0, min: -200, max: 200 },
y: { value: 0, min: -200, max: 200 },
rotate: { value: 0, min: 0, max: 360 },
scale: { value: 1, min: 0.5, max: 2, step: 0.1 }
})
return (
<motion.div animate={{ x, y, rotate, scale }}>
Content
</motion.div>
)
}
import { useControls } from 'leva'
function Scene() {
const { intensity, position, color } = useControls('Light', {
intensity: { value: 1, min: 0, max: 5, step: 0.1 },
position: { value: { x: 0, y: 5, z: 0 } },
color: '#ffffff'
})
return (
<pointLight
intensity={intensity}
position={[position.x, position.y, position.z]}
color={color}
/>
)
}
The Leva panel appears by default in the top-right corner. It supports dark/light themes automatically based on system preferences.
For custom positioning or styling, use CSS:
/* Target the Leva root */
:root {
--leva-colors-accent1: #4c9aff;
--leva-colors-accent2: #5c6bc0;
}
| Control Type | Input | Output |
|---|---|---|
| Number | count: 42 | { count: number } |
| String | name: 'text' | { name: string } |
| Boolean | enabled: true | { enabled: boolean } |
| Color | color: '#fff' | { color: string } |
| Select | size: { options: [...] } | { size: string } |
| Vector2D | pos: { x: 0, y: 0 } | { pos: {x, y} } |
| Vector3D | pos: { x, y, z } | { pos: {x, y, z} } |
| Range | range: [20, 80] | { range: [number, number] } |
| Button | button(() => {}) | void |
| Image | image: { image } | { image: string | undefined } |
import { useControls, folder, button, buttonGroup } from 'leva'
import { motion } from 'framer-motion'
function CompleteDemo() {
const {
// Basic
name,
count,
enabled,
// Visual
color,
size,
opacity,
// Position
position,
// Advanced
duration,
easing,
quality
} = useControls({
// Basic group
name: 'Demo',
count: { value: 42, min: 0, max: 100 },
enabled: true,
// Visual group
Visual: folder({
color: '#4c9aff',
size: { value: 'medium', options: ['small', 'medium', 'large'] },
opacity: { value: 1, min: 0, max: 1, step: 0.01 }
}),
// Position
position: { value: { x: 0, y: 0 }, step: 5 },
// Advanced
Advanced: folder({
duration: { value: 1000, min: 100, max: 3000, suffix: 'ms' },
easing: { value: 'easeOut', options: ['linear', 'easeIn', 'easeOut'] },
quality: { value: 'high', options: ['low', 'medium', 'high'] }
}, { collapsed: true }),
// Actions
'Reset': button(() => console.log('Reset!')),
'Actions': buttonGroup({
Save: () => console.log('Save'),
Load: () => console.log('Load')
})
})
return (
<motion.div
style={{
backgroundColor: color,
opacity,
width: size === 'small' ? 100 : size === 'medium' ? 200 : 300
}}
animate={{ x: position.x, y: position.y }}
transition={{ duration: duration / 1000 }}
>
{name} - {count}
</motion.div>
)
}
✅ Use Leva when:
❌ Don't use Leva for:
Leva excels at rapid prototyping and real-time parameter tweaking during development!
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience