Forked from addisonschultz/generatePropertyControls.ts
Created
July 15, 2023 23:17
-
-
Save airandopal/427f9022bbf4327bae13d4e1b53916c8 to your computer and use it in GitHub Desktop.
Reuse Property Controls easily in Framer X
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { ControlType, PropertyControls } from "framer"; | |
| export function generatePropertyControls( | |
| options: { | |
| hidden?: (props: any) => boolean; | |
| omittedProperties?: string[]; | |
| } = {} | |
| ): PropertyControls { | |
| const properties: PropertyControls = { | |
| // Property Controls go here | |
| }; | |
| if (!!options.omittedProperties) { | |
| return Object.keys(properties).reduce<PropertyControls>((acc, key) => { | |
| if (options.omittedProperties.indexOf(key) === -1) { | |
| acc[key] = properties[key]; | |
| } | |
| return acc; | |
| }, {}); | |
| } | |
| return properties; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
export function Component(props) {