Getting Started
If you're just getting started with CustomBlocks.io, this is where to start.
Syntax - Building Blocks
CustomBlocks works with a very simple syntax, which is described here. (Where is no-code?)
It's very similar to Mustache, but with additional logic for building dynamic elements and connecting to Notion.
Basic Text
If you create a new block, you get the following:
As you can see, you can just write text, like you're used to in Notion. All text will just be displayed as plain text and each line will be a paragraph. What #block
and #link
means in this context is described below in 'Elements'
Connecting to Notion
If you want to connect a Notion resource, you can use the 'Connect Page' and 'Connect Database' buttons in the Editor. If you connect any resource from Notion, it will look like this:
You can also write this manually, if you want to.
Using Notion Resources
You can all use imported resources with the following syntax: {{ Page.PropertyName }}
.
For example, if you have a Notion page called "Invoice", with the parameters "Title", "Amount" and "Customer", you can write something like:
This will translate to for example:
This is our invoice #2021055 with our customer Chris
and the Amount of 451 dollar.
2
Styling
You can style your blocks with tailwindcss
Within #block-elements you can add your "styling" as tailwindcss-classes.
We prepared some simple classes for you, if you're just starting out:
All styling gets realtime generated by the tailwindcss-jit-compiler. Thanks to @BeyondCode for it's awesome project Tailwinds JIT compiler via CDN, which made this feature possible.
Elements / Controlls
Just Text
You can even use no element at all, and just write some text
Block
A #block-element is a block you can style with tailwindcss classes.
Link
A #link-element can direct to any external link and you can add Notion urls as well.
If
You can create basic if-constructs:
Each
A #each-element iterates through your database elements
There is also a shortcut for iterating, which you can use like this:
Nesting ability of Elements
You can nest all elements within your block. No limitation to your creativity.
Using Notion Databases and Pages
You can use all your Notion resources you have connected through the Notion API.
With our powerfull syntax you can easily filter and display your data from Notion.
Import Notion Database
Usually you don't have to connect Notion databases manually. Simply press 'Connect to Notion' within the CustomBlocks Editor, to connect to a
To use your database information from Notion within CustomBlocks, you can simply import it like this at the top of a block:
>> connect.db xxxx-xxxx-xxxxxxxx-xxxx-xxxx as Invoices
>> connect.db
indicates, that you want to import a Notion database.xxxx-xxxx-xxxxxxxx-xxxx-xxxx
is the uuid of the Notion database, which you can always find within your Notion url: https://www.notion.so/notionname/2e1fd1df41454182ba1ced9215fbf94eas Invoices
indicates you want this name for this database. Usually you use the same name, which you have used for your database.
Import Notion Page
Also the Notion pages don't have to be connected manually.
To display your page propertis, you can simply import it like this at the top of a block:
>> connect.page xxxx-xxxx-xxxxxxxx-xxxx-xxxx as Invoice
>> connect.page
indicates, that you want to import a Notion page.xxxx-xxxx-xxxxxxxx-xxxx-xxxx
is the uuid of the Notion page, which you can always find within your Notion url: https://www.notion.so/notionname/2e1fd1df41454182ba1ced9215fbf94eas Invoice
indicates you want this name for this database. Usually you use the same name, which you have used for your page.
Filter Notion Databases
You can always filter your imported Notion databases. Simply write a straighforward formular, what you want to filter:
Display Data as JSON
If you want to display the current data - to check for certain properties - you can just put your variable within brackets and the whole data will be displayed as JSON:
Commands
Commands can be used to create complex elements or helpfull information.
Commands usually start with @
.
@sum
With the command @sum(...)
you can get the amount of items within the selected database.
@group
With the command @group(...)
you can group your database based on a property. All other properties will be summarized based on the selected grouping property.
For example, if you have customers for your invoices, you can sum up the total of all customers with the following statement:
@count
With the command @count(...)
you can get the amount of items within the selected database.
@chart
This allows you create your own charts, based on imported Notion databases.
The syntax is:
@chart(<type>, <database>, <title-property>, <number-property>)
Height, chart color and text color are optional parameters (full examples):
@chart(<type>, <database>, <title-property>, <number-property>, <height[default:400]>, <chart-color[default:black]>, <text-color[default:lightgray]>)
@html and @endhtml
Those two commands indicate the parser you can use simple html within them.
@html
<div class="float-left">Hi, this is some html floating around 🥁💤</div>
<a href="https://customblocks.io">Links are possible</a>
<button>❌</button>
<svg>❌</svg>
@endhtml
2
3
4
5
6
7
8
9
10
WARNING
This is still very experimental and does not allow some critical elements, like 'svg' and 'button'. Please use with care.
Roadmap
Operations with variables
We're already working on operations within variables.
No-code features
No-code features are already planned out and will be implemented in the next few releases.
The plan is to enable more non-developers to create their own blocks easily in Version 2.0 of CustomBlocks.