1. Reference
  2. Metadata

<notification>

Wires local and push notifications into the page: schedule one, and act when one is tapped.

Metadata Uses notifications

This tag needs notification permission on a device, so try it on your phone.

notification.ham
<column style="gap-12 w-full">
    <notification permission="silent"
                  on-tap="file:/$notify.data.route"/>
    <text style="font-bold">Daily reminder</text>
    <button variant="filled"
            icon="notifications"
            action="notify:Time to stretch:Stand up for two minutes.:delay:600">Remind me in 10 minutes</button>
</column>
The snippet drawn by Hype Apps on a phone, in light mode The snippet drawn by Hype Apps on a phone, in dark mode
This snippet as Hype Apps draws it on a phone. It follows this page's light or dark theme.

Attributes

NameWhat it doesDefault
at When to show it: ISO 8601, or HH:mm for the next occurrence today/tomorrow.
string
body Body of the declarative local notification.
string
local true schedules one local notification declaratively on mount (needs title).
boolean
permission ask requests OS permission on mount if not yet decided; silent / deferred never auto-request (call notify:permission:request).
ask, silent, deferred
ask
register Endpoint to POST the push device token to: {token, device_id, platform, authorization}, and on iOS apns_environment (development or production). authorization is what the OS allows now (iOS: authorized, denied, provisional, ephemeral, notDetermined; Android: granted, denied): iOS gives a token with alerts turned off. Sent once per endpoint, token, session and authorization: after a sign-out and a sign-in, or notifications turned on or off in Settings, it is sent again.
url
tag Stable id: rescheduling with the same tag replaces; notify:cancel:{tag} cancels.
string
title Title of the declarative local notification.
string

Events

NameWhat it does
on-receive Action run when a notification arrives while the app is open.
on-tap Action run when the user taps a notification, including the tap that cold-launched the app.

Any tag also takes gestures: @on.tap, @on.longpress, @on.doubletap and @on.swipeleft (and right, up and down). @click runs on a tap too.

This page is also Markdown, and all of HAM is in llms.txt.