Figma Plugin
The Formhaus Figma plugin renders form mockups from form definitions using your design system components.
Install
- Open the
packages/figmafolder in the repo - In Figma, go to Plugins > Development > Import plugin from manifest
- Select
packages/figma/manifest.json - The plugin appears under Plugins > Development > Formhaus
Building from source
cd packages/figma
pnpm buildThis compiles code.ts into the bundled plugin code that Figma runs.
Usage
- Open a Figma file
- Run the plugin (Plugins > Formhaus)
- Paste a
@formhaus/coreform definition into the Generate tab - Click Generate
The plugin creates a frame for each step (or one frame for single-step forms) with your design system components rendered inside.
Quick test
Click Load example in the plugin to load a basic contact form definition. Hit Generate to see it render with the default component map.
Component Map
The Component Map tells the plugin which Figma components to use for each form field type.
Auto-generate with Claude
Instead of editing this JSON manually, run /formhaus-figma-connect to scan your design system and generate the component map automatically.
Structure
{
"formsConstructorKey": "COMPONENT_SET_KEY",
"formHelperTextKey": "HELPER_TEXT_KEY",
"buttonKey": "BUTTON_KEY",
"fields": {
"text": { "formsConstructorVariant": "Input" },
"email": { "formsConstructorVariant": "Input" },
"textarea": { "formsConstructorVariant": "Textarea" },
"select": { "formsConstructorVariant": "Select" },
"checkbox": {
"standalone": true,
"standaloneKey": "CHECKBOX_KEY",
"variantProps": { "Type": "Checkbox", "State": "Static" }
}
},
"textLayerNames": {
"label": "Header",
"placeholder": "Placeholder",
"helperText": "Helper text"
}
}Key concepts
| Field | Description |
|---|---|
formsConstructorKey | Key of the main component set that contains Input, Textarea, and Select as variants |
formHelperTextKey | Key of a helper text component (optional) |
buttonKey | Key of the button component set |
fields | Maps each field type to a component |
textLayerNames | Names of text layers inside your components (for labels, placeholders, helper text) |
2 types of field mappings
formsConstructor variants, fields that are variants within a single component set:
"text": { "formsConstructorVariant": "Input" }The plugin finds the variant named "Input" inside the formsConstructorKey component set.
Standalone components, fields that use their own separate component:
"checkbox": {
"standalone": true,
"standaloneKey": "YOUR_COMPONENT_KEY",
"variantProps": { "Type": "Checkbox", "State": "Static", "Checked": "False" }
}The plugin imports the component by standaloneKey and applies variantProps to select the right variant.
Finding component keys
To find a component key in Figma:
- Right-click a component in Figma
- Copy/Paste > Copy link
- The key is in the URL, or use the Plugin API:
figma.currentPage.selection[0].key
Configuring in the plugin
- Open the plugin and switch to the Component Map tab
- Click Load Current to see the active map
- Edit the JSON to match your design system
- Click Save Map to persist (stored in Figma's local storage)
- Use Reset to Default to go back to the example map
Missing components
If your design system doesn't have a component for a field type (e.g., file upload or date picker), mark it as missing:
"file": { "standalone": true, "missing": true },
"date": { "standalone": true, "missing": true }Missing fields render as red placeholder frames in the generated output.
What the plugin generates
For each form, the plugin creates:
- A card frame (400px wide, white background, auto-layout)
- Field components arranged vertically with proper labels, placeholders, and helper text
- Submit/cancel/back buttons at the bottom
- For multi-step forms: one card per step, arranged horizontally
The output uses instances of your design system components.
Customizable layout coming soon
The card width (400px), padding, and spacing are currently fixed. Future versions will make these configurable so you can match your design system's layout grid.
Next steps
- /formhaus-create-form: generate form definitions from text descriptions
- /formhaus-figma-connect: auto-detect your design system components
- Field Types: all supported form field types
- Examples: example definitions to try with the plugin