🎁 Unwrapping the Fifth of Our Festive Releases: Selection API in GA, and other exciting updates to `@canva/design` and `@canva/asset` packages!

Part two of our double header for today involves some very exciting and much-anticipated updates to the @canva/design and @canva/asset SDK.

:gift: 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.

:hook: 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.

:link: 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.

:framed_picture: 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!

12 Likes

This is a massive one! Our first fully available API to read what is already on a design. I’m very excited to see what everyone builds with this!! :santa: :raised_hands: :tada:

4 Likes

Indeed, amazing to see this come to life.
A Christmas gift indeed, thank you to all the awesome Canva staff that made it happen! :christmas_tree: :gift: :santa:

4 Likes

Hey @Amr_Mashlah , check this one out :christmas_tree:

1 Like