AppNotificationPreview
A lock-screen picture of a push notification on iOS or Android, for a "send notification" form. It clamps text the way each phone does and warns when the title or message would be cut off.
Install: pnpm add-component AppNotificationPreview
Composer
Bind the preview to the form fields. The sample message is long enough to be cut: switch to Android to lose two more lines, or expand to see all of it.
Drips out of the island
With island, the pill, a neck and the card are three shapes in one AppBlob: a drop falls out of the pill on a stretched neck and swells into the card, then the neck snaps and the pill springs back. The text rises in as it lands. Pine bounces; reduced motion shows the card at once.
iOS and Android
The same notification with an image. iOS shows the image under the text; Android shows a thumbnail beside it until the card is expanded.
Stack and wallpaper
stack draws the cards waiting behind this one. wallpaper takes any CSS background.
Static picture
For marketing or docs: pin the clock with time and turn off the cut-off note.
API
appName(string): The app name the phone prints above the notification. Its initial is the fallback icon.title(string): Notification title. One line on both platforms.message(string): Notification body. Four lines on iOS, two on Android. Line breaks are kept.icon(string): Iconify name for the app icon. iconSrc and the #icon slot take precedence.iconSrc(string): Image URL for the app icon, such as the app's logo.image(string): Attached image URL. Below the text on iOS; a thumbnail beside it on Android until expanded.platform('ios' | 'android'): Which phone draws it. They clamp differently, so check both before sending.appearance('light' | 'dark'): The card's own theme, independent of the site's.expanded(boolean): The long-press view: no line clamps, full message and image.island(boolean): iOS only. The card drips out of the Dynamic Island in the island's black (AppBlob) and lands under it, and the text rises in once the shape is there. appearance and stack do not apply.time(Date | string | number): What the lock-screen clock shows. Leave it out to show the current time.live(boolean): Re-reads the clock every 30s when no time is given.locale(string): BCP 47 locale for the clock and date, passed to Intl.when(string): The timestamp printed on the card.stack(number): How many more notifications wait behind this one. Up to 2 are drawn.wallpaper(string): Any CSS background for the screen. Keep it dark enough for the white clock.titlePlaceholder(string): Shown, dimmed, while title is empty.messagePlaceholder(string): Shown, dimmed, while message is empty.caption(string): A note under the phone. The #caption slot replaces it and receives { titleCut, messageCut }.warnCutoff(boolean): Measures the clamps and shows a note when the lock screen hides text. Turn it off for a static picture.cutoffLabel(string): {part} becomes "title", "message" or "title and message".@truncate((cut: { title: boolean; message: boolean }) => void): Fires when what is cut off changes, so a form can warn or block sending.