Your First Page - Step 5
Build your first Thorm page and learn the basic workflow: structure, state, and rendering mode.
The Libraries: Contact
/Components/Contact.php This component builds the main contact section with two functional areas:
- Static business contact info: it defines a contactInfo atom array (phone, email, HQ address, hours) and renders it client‑side using (repeat(...). This produces a consistent list without hardcoding each entry in markup. It also shows a static HQ map image. Using an atom here, showcase how to make the content dynamic, as the atom can change state (updating its content from an API endpoint) which will automatically change the content in page.
- Dynamic contact form: it renders a form that captures full name, email, subject, and message using Thorm atoms for live input state. On submit, it prevents the browser’s default form action and sends a POST request to(/tutorials/api/ with the form data in application/x-www-form-urlencoded format. The response is stored in $response, and the UI flips to a “Plan received” view that displays the server message. After 10 seconds, it resets and shows the form again.
- Switching between the form contact and server response is done through a bit of reactivity, we store the state of the form submission on $messageSent then we update its value on the effect onSelf() actions. Changing the atom value will trigger the show(eq(read($messageSent), true/false), ...) to show the right component.
So functionally, it’s the page’s core: a static, runtime‑built “contact methods” column, and a dynamic form that submits data asynchronously and shows the server’s reply without a full page reload.
PHP
Status: Developer Preview
Things may change, things might break. If something feels awkward, it's probably a design edge we're still smoothing out.
On this page