Widgets are embebed HTML blocks that serve some purpose. This purpose can be a useful one, such as being a pomodoro time tracking or a countdown for a specific date, but it can also be a styling o fun purpose, such as a tamagochi in your workspace or a daily quote.
There are some products that you can use to add widgets more easily to your page, and if they are good enough for you, great! This post is not for you then.
But if you always feel like there is something missing on them, or that you would change a font or the color of a widget, then keep reading.
but now, let’s get into the real part…
So, now we knows that widgets are html snippets that are shown inside your notion page as if they were a widget (like a smartphone widget), BUT we can’t just paste the html code inside the page (maybe that is something that notion can add in the future? it would make things quite easier…)
But if we can’t just throw some code there, where do we put it?
then, give it a name and make it public
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Hello, you!</title>
</head>
<body>
<div>
Hello, you!
</div>
</body>
</html>
the code above is for this widget that shows “Hello, you!” on the screen.
we now have the widget code on the repository, and the only thing left to do is make the widget public on a webpage and embed it on our notion page!
then, click on Actions (fourth option from left to the right on the image above and access the workflow
and in there, once the deployment finishes, you will get the link to your page.
when you click it, you will get a 404, but that is normal! Just add the name of the file you created to the end of the url, and you should be able to see the “Hello, you!” on your webpage!
Now, just copy this link, paste it on your notion and select the “create embed” option
and you will have the widget embed!
Congratulations! Now you can have as many widgets as you want on your notion pages! Just folow the steps:
I need your help creating a notion widget.
Notion widgets are HTML code snippets that are embed on my notion page. They should follow the template below, where the content between two curly braces are for you to fill:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{{name of the widget}}</title>
<style>
{{widget style in CSS}}
</style>
</head>
<body>
{{widget content in HTML}}
<script>
{{widget script in JavaScript, if needed}}
</script>
</body>
</html>
Can I start describing the widget I want?
Tip: after describing your widget, end the prompt with “is there anything that I can make clearer or any doubts you have that I can answer?” This can help getting better results!
For example, I entered the prompt below for a pomodoro tracker
The widget I want is a pomodoro tracker. It should initially display two boxes, one with a 25min countdown and the other with a 5min countdown. Below those timers, there should be a play button.
Once I click play, the 25min timer should begin its countdown. On the last 3 seconds, it should make a bipping sound so that I know that the timer is about to end. Once it ends, it should automatically begin the 5min timer, and then it should follow the same rules as the 25min (playing sounds and automatically starting the other timer once it finishes).
For the styling, keep it clean. Only use black and white colors, add rounded corners on the boxes and use some monospace font
Is there anything I can make clearer or any doubts you have that I can answer?
And the result, you can check on the following link! (If you like it, feel free to embed it on you notion pages!)
Pomodoro Tracker (fecampossantos.github.io)
PS: chatGPT warned me that the widget does not have the sound functionality
PS2: There are a LOT of improvements that can be made regarding the style (chatGPT is not known for its styling creativitiy….) but I’ll leave that to you!
https://github.com/fecampossantos/notion-widgets