Currently, clothion is pretty limited in term of widgets.

But if you have front-end experience, you can leverage the API to build your own widget !

<aside> <img src="/icons/paint-roller_gray.svg" alt="/icons/paint-roller_gray.svg" width="40px" /> Consider contributing to clothion ! Experienced front-end devs are much needed…

</aside>

Creating a custom widget

Open any online Javascript editor (Replit, Codepen, JSFiddle, etc…). For this example I’ll be using repl.it.

I wrote some custom HTML / Javascript to create my own widget. You can check the code here :

Custom Clothion Widget


If you check the Javascript code, you can see that I query the clothion API, select the attribute Price of a random row (I’m using this Notion table as data source), and display it in my widget. If the price is above a certain threshold, I change the color of the widget’s border.

<aside> <img src="/icons/location_gray.svg" alt="/icons/location_gray.svg" width="40px" /> See the page API reference for full details on how to query the API.

</aside>


Then, I can just copy the preview link of the widget, and embed it into Notion, like so :

https://custom-clothion-widget.nicolasremond.repl.co/

And that’s it ! With the clothion API, you don’t need to host anything, you can just roll your own widget and embed it into Notion, just like that.

Why can’t I just use the Notion API ?

The Notion API is CORS-blocked, which means you can’t access it from client-side.

You need to do all the queries to the Notion API on the server side. This means you need a server…

By comparison, the clothion API allows CORS requests. You can just query the data through clothion from client-side, so you can just write the front-end part of your widget and let clothion takes care of the rest !