3-Minute Quick Start
Learn how to publish a canvas and embed it in your app.
Last updated
Learn how to publish a canvas and embed it in your app.
Last updated
Quick preview feature lets you publish and preview a canvas in a single click. The layouts get published instantly and sync with any changes you make in the canvas. This is useful to test and debug the layouts.
Select the canvas you wish to publish and press the Quick Preview button in the app bar.
This will upload the canvas and open up a dialog with all the necessary information you need to preview the canvas.
You have two options to preview the uploaded canvas:
Tap on the "View a preview" button.
Scan the QR code from the mobile app's scanner to instantly preview the canvas. Alternatively, you can input the Preview Key Code to load the preview.
This is how the preview looks in the mobile app.
Copy-paste the provided code to embed the canvas in your app. CodelesslyWidget
, being a widget, can be embedded anywhere in the widget tree.
CodelesslyWidget
is a widget that renders the layout by utilizing the data of the canvas you publish from the editor. It takes in the following parameters:
layoutID
: ID of the published canvas.
isPreview
: Whether the layout is in preview or production mode. Preview mode is meant for debugging the layout and syncs with the changes made in the editor. Widgets in production mode do not sync and are only updated when explicitly published using the Publish button.
config
: It takes an instance of CodelesslyConfig
that holds the information required to fetch the canvas data from the server. authToken
is required while other parameters are optional.
Before you can use CodelesslyWidget
, you need to initialize the SDK. To do that, simply call the initializeSDK
method before you render any CodelesslyWidget
. Ideally, call it in the main
method.
initializeSDK
takes in several parameters to provide complete flexibility. For example, you can declare config
in this method to make it the default configuration of all CodelesslyWidget
s, unless overriden.
Similarly, you can declare data
and functions
to make them globally accessible.
Here's an example of how you can embed a canvas in your app using Codelessly's SDK:
The app should look like this:
Since the widget is in preview mode, whenever we make a change to the canvas in the editor, it's instantly reflected in the widget as well.
After you have tested your layouts and are ready to make it available to your users, you can publish the layouts by pressing the Publish button.
Once a canvas is published, it is pushed to the users' devices and remains accessible unless deleted explicitly.