Nasaq

SubscriptionLanding

The three public pages of an email list, subscribe with explicit consent, confirm for double opt-in, and unsubscribe with an optional reason and a way back.

PreviewOpen ↗

Code

<SubscriptionLanding mode="subscribe" brand="Nasaq" onSubscribe={async ({ email }) => subscribe(email)} /><SubscriptionLanding mode="confirm" email="[email protected]" onConfirm={confirm} /><SubscriptionLanding mode="unsubscribe" email="[email protected]" onUnsubscribe={unsubscribe} onResubscribe={resubscribe} />

Marketing · beta

Live examples and controls: SubscriptionLanding in the lab.

Install

npx shadcn@latest add https://docs.nasaqui.com/r/subscription-landing.json

The pages a recipient lands on from a signup form or from an email link. One component, three modes.

When to use

  • The public subscribe, confirm and unsubscribe addresses of a newsletter or broadcast list.

When not to use

  • Account sign in: use an auth card.
  • Managing consent inside the app: use ContactIdentities.

Import

import { SubscriptionLanding } from "@fadymondy/nasaq/web";
// inside this monorepo: "@nasaq/web"

Quick start

<SubscriptionLanding mode="subscribe" brand="Nasaq" onSubscribe={async ({ email }) => subscribe(email)} />
<SubscriptionLanding mode="confirm" email="[email protected]" onConfirm={confirm} />
<SubscriptionLanding mode="unsubscribe" email="[email protected]" onUnsubscribe={unsubscribe} onResubscribe={resubscribe} />

Anatomy

  • Subscribe: optional name, email, an unticked consent box, then "Check your inbox".
  • Confirm: a button (never automatic, so mail scanners do not subscribe anyone), then "You are subscribed".
  • Unsubscribe: an optional reason, then "You are unsubscribed" with an undo.

API

PropTypeDescription
mode"subscribe", "confirm" or "unsubscribe"Which page.
brandReactNodeThe sender's name as text.
emailstringFor confirm and unsubscribe. Shown masked.
onSubscribe({ email, name? }) => Promise<...>
onConfirm() => Promise<...>
onUnsubscribe({ reason?, note? }) => Promise<...>
onResubscribe() => Promise<...>Shows the undo.
reasonsstring[]Reason keys.
askNamebooleanAdds a name field.
labelsPartial<SubscriptionLandingLabels>Override any string.

Pure helpers: isSubscriberEmail, maskSubscriberEmail, validateSubscription.

Examples

Pass your own reasons and matching labels.reasons to change the survey.

Accessibility

Errors are announced. Outcomes are role="status". The consent box has a real label.

RTL & i18n

English and Arabic ship. The email field is left-to-right.

Styling & tokens

Semantic tokens only.

Do / Don't

  • Do require an unticked consent box.
  • Don't confirm or unsubscribe on page load.

Lab

https://docs.nasaqui.com/?path=/docs/components-marketing-subscription-landing--docs

On this page