⚡ Quick-start Guide
- From the Dynaboard home screen, click the hamburger menu icon and select Create Workspace. Name your workspace and click Create
- Next, create a new Project by clicking the + icon in the left nav next to your new workspace name.
- Name your project "Coin Flip" and keep the template set to Blank Project. Click Create
- Click on your newly created project to begin designing your app.
Workspaces are containers for your Dynaboard projects, allowing you to centrally manage project access across your team.
Projects are containers for pages and functions of your app.
- That big whitespace in the middle of the screen is called the Canvas where the visual elements of your new app live. The toolbar on top of the canvas contains a menu of elements.
- Drag a Text element and a Button element onto the canvas.
- Now let's wire things up!
- We want to create a server-side resource which will tell us the result of the coin flip.
- Click the Resource icon in the left nav.
- Now click the + and select "Typescript Server Resource". Behind the scenes, Dynaboard creates a space for running your custom Typescript functions.
- Next, make a function to run inside your Typescript resource. Click the Pages icon in the left nav. Then, click the + button next to Page Functions at the bottom of the left nav. You will see the right nav update with the properties of the function.
- Select your Typescript resource in the Resource drop-down menu and you will see a Code section appear on the right nav.
- Let's code! Enter our code into the Code box and click "Test Function"
return Math.random() > 0.5 ? 'heads' : 'tails'
Whew! Take a break from all that typing. Let's wire up the UI.
First, let's bind the Text label to our function by clicking the Text element in the Labels section of the left nav. The right nav will display's its properties. In the Text > Value box enter our function name using double bracket notation.
The text label should update immediately withe result of our coin flip!
Finally, to trigger the coin flip, let's make our Button trigger our function. Click the Button element and select our function from the OnClick drop-down menu.
To test our working app, click the Play button on the top right side of the screen. 🎉