Part two of our double header for today involves some very exciting and much-anticipated updates to the @canva/design and @canva/asset SDK.
Text and Image Selection
The Selection API has undergone some serious improvements and changes based on your feedback, and as a result, it is now out in GA and we are ready to accept your app submissions!
Get started by learning how to read selected elements, and replace them! Be sure to also read the best practices when using this API.
useSelection Hook
To make your lives even easier, weβve added a useSelection hook to the starter kit.
const App = () => {
const selectionEvent = useSelection("image");
console.log(selectionEvent);
}
Remember to follow the rules of hooks if youβre unfamiliar with React hooks.
getTemporaryUrl
To supplement the selection API, the getTemporaryUrl is now also available in GA, to allow you to download the userβs selected images, before editing/replacing them with the Selection API.
Background Images
We had recently announced the release of the setCurrentPageBackground as a Preview API. Well, it is now also available in GA and ready to be used in your apps!
The addPage API will also allow for background images to be set!
We cannot wait to see what you create with all these new APIs, and are looking forward to your app submissions!