Custom Components
You can now import your custom components to your React, Next.js, Angular & Gatsby locofy projects and map them to the respective Figma Components. Locofy will replace your Figma components with the custom component code with the correct props as you generate code for your screens.
Import Custom Components
New Locofy Project
- Run the Locofy Figma Plugin. You may view our documentation on installing the Locofy plugin from here.
- Create a new locofy project of React, Next.js, Angular or Gatsby framework.
- Import your Custom Components.
Existing Locofy Project
- Run the Locofy Figma Plugin. You may view our documentation on installing the Locofy plugin from here.
- Select the existing locofy project of React, Next.js, Angular or Gatsby framework.
- Click on the Badge or the custom components icon next to the project dropdown.
- Import your Custom Components.
Importing
Your can import your custom components using one of the following
- Import using Locofy CLI from your codebase
- Import from a Github respository.
- Import from a public or private Storybook.
Note: You may view our documentation on how to structure components in code and this documentation on how to structure your Figma components.
Mapping your Custom Components to the Figma Components
- LocoAI automatically maps your custom components to the Figma components.
- If any custom components are not mapped automatically or you want to change the mapped component, you can use the Locate mode to map your custom component to the requisite figma component.
- You can also update the custom components mapping by either editing or deleting the mapping.
- You can detach the entire custom component library should you want to as well.
Generating Code for the requisite screens
You can now select the frames you want to convert to code and run Locofy Lightning on them
Locofy automatically detects the custom components in your designs and pre-fills them with the appropriate props. It also generates the code for the remaining UI and makes the design interactive, responsive and modular with repeated code components.
Editing Props of Custom Components
After mapping of custom components you can also edit props dynamically, be it style props, value props or conditional props. To edit props:
- Go to Code Components & Props review.
- There select the component which you want to edit.
- Select the instance you want to edit.
- Edit the properties of the custom components and view the updated preview.
Note: If you have className
prop for your custom components then you can editing the Component's Styling & Responsiveness in the review section. Furthermore, if your component has an onClick
prop you can configure it in the Actions & Interactions review section.