We’re excited to introduce MediaSlotWithAutoSelect to the Content Publisher Intent preview. Apps can now ask Canva to pre-select all valid inputs as files when the publish panel first opens.
What’s new
-
MediaSlotWithAutoSelectis a new shape available for media slots returned bygetPublishConfiguration. -
Set
autoSelect: "all_valid_inputs_as_files"to enable automatic selection. -
Provide a required
fileCountconstraint. -
Define a single media requirement directly in
accepts, such as{ format: "jpg" }.
These options are documented in the prepareContentPublisher API reference.
Why it matters
This can reduce manual selection for workflows such as publishing a bulk created design, helping users start with valid content already selected.
How to use it
Return the slot from getPublishConfiguration and register your handlers with prepareContentPublisher. This example assumes your existing UI and publishing handlers are defined in publish-handlers:
import {
prepareContentPublisher,
type GetPublishConfigurationResponse,
type MediaSlotWithAutoSelect,
} from "@canva/intents/content";
import {
renderSettingsUi,
renderPreviewUi,
publishContent,
} from "./publish-handlers";
const imagesSlot: MediaSlotWithAutoSelect = {
id: "images",
displayName: "Post images",
fileCount: { min: 1 },
accepts: {
format: "jpg",
},
autoSelect: "all_valid_inputs_as_files",
};
async function getPublishConfiguration():
Promise<GetPublishConfigurationResponse> {
return {
status: "completed",
outputTypes: [
{
id: "image_collection",
displayName: "Image collection",
mediaSlots: [imagesSlot],
},
],
};
}
prepareContentPublisher({
getPublishConfiguration,
renderSettingsUi,
renderPreviewUi,
publishContent,
});
As with all preview APIs, these capabilities are unstable and may change without warning. They can’t be used in public apps until they become stable.