3 ms·
Can I make my own prop editor? Ex. instead of an input for the prop `name` I want a picker that fetches data from some API
by d0100 3y ago
Can I make my own prop editor?
Ex. instead of an input for the prop `name` I want a picker that fetches data from some API
- chrisvxd 3y agoYou can use adaptors for this. Adaptors let you request a third party API via the `adaptor` field type. Docs are limited, but there's a reference data shape here: https://github.com/measuredco/puck#adaptor https://github.com/measuredco/puck#adaptor Example implementation here: https://github.com/measuredco/puck/blob/main/packages/adaptor-strapi/index.ts https://github.com/measuredco/puck/blob/main/packages/adapto... Example usage here: https://github.com/measuredco/puck/blob/main/apps/demo/app/configs/custom/blocks/Hero/index.tsx#L36-L46 https://github.com/measuredco/puck/blob/main/apps/demo/app/c... You can either use it for a specific prop (i.e. `name`) or spread the result of the API call across your entire component (use the magic `_data` prop).
- chrisvxd 3y agoThis might be a better example, actually: https://github.com/measuredco/puck/tree/main/packages/adaptor-fetch https://github.com/measuredco/puck/tree/main/packages/adapto...