Thorm
Get started
Get Started in 5 minutes
First Page
Your first page
The controller
Header
Hero section
Contact section
The API
Considerations
Docs
Overview
Guides
Intro
Atoms
Node builders
Props helpers
State + expressions
Expression builder
Events + actions
Effects + targets
API
Api
Examples
Roadmap
Blog
Community
Get Started
GitHub
Counter
A simple stateful counter that reacts to clicks and shows even/odd state.
Count: 1
is odd
Inc
PHP
📄 Copy code
<?php $cnt = state(1); $app = el('div', [ cls('container mt-5') ], [ el('h2', [cls('h4')], [ text(concat('Count: ', read($cnt))), show(eq(mod(read($cnt), 2), 0), el('span', [ cls('') ], [ text(' is even') ])), show(eq(mod(read($cnt), 2), 1), el('span', [ cls('') ], [ text(' is odd') ])), show(eq(mod(read($cnt), 13), 0), el('p', [ cls('h6') ], [ text('How odd is that 🙃?') ])), ]), el('button', [ cls('btn btn-warning'), on('click', inc($cnt, 1)) ], [ text('Inc') ]), show(eq(mod(read($cnt), 2), 0), el('span', [ cls('m-5 fs-5') ], [ text('Even!') ])) ]);