# Newsletter signup

A native newsletter email block with consumer-owned submission, status, consent, and delivery behavior.

Access: pro. Category: Forms. Kind: composite.

## When to use

- Use it when a page needs a native newsletter email block with consumer-owned submission, status, consent, and delivery behavior.
- Choose it as the cta region when composing a page from independently reusable TidalUI sections.

## Alternatives

- Choose form-field instead when a labeled email field with validation and help text is the actual interface need, rather than newsletter signup.

## Setup for agents

Use React 19 and TypeScript. Initialize shadcn for your framework, then merge this exact entry into components.json:

```json
{
  "registries": {
    "@tidal-pro": {
      "url": "https://tidalui.com/r/pro/{name}.json",
      "headers": {
        "Authorization": "Bearer ${TIDALUI_TOKEN}"
      }
    }
  }
}
```

The namespace must be named **@tidal-pro** because transitive Pro dependencies use that namespace. Obtain an agent key from your active Pro account at https://tidalui.com/account. Keep TIDALUI_TOKEN in your local environment, never in components.json, client code, Git or logs.

```sh
export TIDALUI_TOKEN='your-private-agent-key'
npx shadcn@latest add @tidal-pro/waitlist-form
npx shadcn@latest add https://tidalui.com/r/tidal-button.json
```

Free command: `npx shadcn@latest add https://tidalui.com/r/<name>.json`.
Pro command: `npx shadcn@latest add @tidal-pro/<name>`.

Import the base stylesheet and every stylesheet listed on the installed item's metadata. For example:

```tsx
import "./components/ui/tidal.css";
import "./components/ui/hero-section.css";
// Place installed components inside this wrapper:
<div className="tidal-scope" data-theme="dark">...</div>
```

Omit data-theme for the default light theme. Put the attribute on the same tidal-scope element for dark mode. Every component installs the shared free tidal-base dependency. After upgrading, run `npx shadcn@latest add https://tidalui.com/r/tidal-base.json --overwrite` to receive current tokens. Review local modifications before overwriting.

Vite: Use React + TypeScript. Map @/* to ./src/* in paths and Vite resolve.alias. Import tidal.css and each component stylesheet in your application entry.

Next.js 15 App Router: Next.js App Router: import tidal.css and component CSS in app/layout.tsx. Interactive examples belong in a client component with "use client". Map @/* to ./* or ./src/* to match your project.

TypeScript 6: use paths without baseUrl:

```json
{
  "compilerOptions": {
    "paths": {
      "@/*": [
        "./src/*"
      ]
    }
  }
}
```

Pro registry requests are server/CLI-only. Use the same-origin account interface in a browser; cross-origin Authorization preflights are intentionally unsupported.


## Install Newsletter signup

```sh
npx shadcn@latest add @tidal-pro/newsletter-signup
```

Stylesheets: `components/ui/tidal.css`, `components/ui/newsletter-signup.css`.

## Minimal example

```tsx
import"./components/ui/tidal.css";
import"./components/ui/newsletter-signup.css";
import{TidalNewsletterSignup}from"./components/ui/newsletter-signup";
export default()=><div className="tidal-scope"><TidalNewsletterSignup title={"Demo"}/></div>;
```

## Structured props

- `TidalNewsletterSignup.title: ReactNode`: Required title value accepted by this exported component.
- `TidalNewsletterSignup.consent?: ReactNode`: Optional consent value accepted by this exported component.
- `TidalNewsletterSignup.description?: ReactNode`: Optional description value accepted by this exported component.
- `TidalNewsletterSignup.emailDescription?: string | undefined`: Optional email description value accepted by this exported component.
- `TidalNewsletterSignup.emailError?: string | undefined`: Optional email error value accepted by this exported component.
- `TidalNewsletterSignup.emailInputProps?: NewsletterEmailInputProps | undefined`: Optional email input props value accepted by this exported component.
- `TidalNewsletterSignup.emailLabel?: string | undefined` (default "Email address"): Optional email label value accepted by this exported component.
- `TidalNewsletterSignup.emailRef?: Ref<HTMLInputElement> | undefined`: Optional email ref value accepted by this exported component.
- `TidalNewsletterSignup.eyebrow?: ReactNode` (default "Newsletter"): Optional eyebrow value accepted by this exported component.
- `TidalNewsletterSignup.footer?: ReactNode`: Optional footer value accepted by this exported component.
- `TidalNewsletterSignup.headingLevel?: "h2" | "h3" | "h4" | undefined` (default "h2"): Optional heading level value accepted by this exported component.
- `TidalNewsletterSignup.onStatusAction?: ((status: Exclude<TidalNewsletterSignupStatus, "idle">) => void) | undefined`: Callback invoked when the status action interaction is proposed.
- `TidalNewsletterSignup.pendingLabel?: string | undefined` (default "Please wait"): Optional pending label value accepted by this exported component.
- `TidalNewsletterSignup.status?: TidalNewsletterSignupStatus | undefined` (default "idle"): Optional status value accepted by this exported component.
- `TidalNewsletterSignup.statusActionButtonProps?: Omit<ButtonHTMLAttributes<HTMLButtonElement>, "type" | "children"> | undefined`: Optional status action button props value accepted by this exported component.
- `TidalNewsletterSignup.statusActionLabel?: string | undefined`: Optional status action label value accepted by this exported component.
- `TidalNewsletterSignup.statusActionRef?: Ref<HTMLButtonElement> | undefined`: Optional status action ref value accepted by this exported component.
- `TidalNewsletterSignup.statusMessage?: ReactNode`: Optional status message value accepted by this exported component.
- `TidalNewsletterSignup.statusRef?: Ref<HTMLDivElement> | undefined`: Optional status ref value accepted by this exported component.
- `TidalNewsletterSignup.submitButtonProps?: Omit<ButtonHTMLAttributes<HTMLButtonElement>, "type" | "children"> | undefined`: Optional submit button props value accepted by this exported component.
- `TidalNewsletterSignup.submitLabel?: string | undefined` (default "Join newsletter"): Optional submit label value accepted by this exported component.
- `TidalNewsletterSignup.submitRef?: Ref<HTMLButtonElement> | undefined`: Optional submit ref value accepted by this exported component.

## Complete usage example

[Source](https://tidalui.com/examples/newsletter-signup.tsx) | [Manifest](https://tidalui.com/examples/newsletter-signup.json). Install the listed additional dependencies. Consumer fixture: TypeScript pass; Vite pass. This fixture check is distinct from the actual shadcn install receipt.

```tsx
"use client";

import "./components/ui/tidal.css";

import { useEffect, useLayoutEffect, useRef, useState, type FormEvent, type InvalidEvent, type ReactNode } from "react";

import { RotateCcw } from "lucide-react";

import { TidalNewsletterSignup, type TidalNewsletterSignupStatus } from "./components/ui/newsletter-signup";

import "./components/ui/newsletter-signup.css";

import "./components/ui/form-field.css";



const tidalExampleStyles = ".tidal-scope .newsletter-signup-demo {\n  width: 100%;\n  max-width: 980px;\n  min-width: 0;\n  padding: 28px;\n  border: 1px solid var(--t-border);\n  border-radius: 18px;\n  background:\n    linear-gradient(var(--t-border) 1px, transparent 1px),\n    linear-gradient(90deg, var(--t-border) 1px, transparent 1px),\n    var(--t-subtle);\n  background-size: 24px 24px;\n  color: var(--t-ink);\n  container-type: inline-size;\n}\n\n.tidal-scope .newsletter-signup-demo,\n.tidal-scope .newsletter-signup-demo * {\n  box-sizing: border-box;\n}\n\n.tidal-scope .newsletter-signup-demo-layout {\n  min-width: 0;\n}\n\n.tidal-scope .newsletter-signup-demo-layout > .tidal-newsletter-signup {\n  max-width: none;\n}\n\n.tidal-scope .newsletter-signup-demo-footer {\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n  gap: 12px;\n  min-width: 0;\n}\n\n.tidal-scope .newsletter-signup-demo-footer > span {\n  min-width: 0;\n  overflow-wrap: anywhere;\n}\n\n.tidal-scope .newsletter-signup-demo-footer > button {\n  display: inline-flex;\n  align-items: center;\n  justify-content: center;\n  gap: 7px;\n  min-width: 44px;\n  min-height: 44px;\n  flex: none;\n  padding: 8px 10px;\n  border: 1px solid var(--t-border);\n  border-radius: 9px;\n  background: var(--t-surface);\n  color: var(--t-ink);\n  font: inherit;\n  font-size: 11px;\n  cursor: pointer;\n  transition:\n    background 160ms,\n    transform 140ms var(--t-ease-out);\n}\n\n.tidal-scope .newsletter-signup-demo-footer > button:hover {\n  background: var(--t-wash);\n}\n\n.tidal-scope .newsletter-signup-demo-footer > button:active {\n  transform: scale(0.98);\n}\n\n.tidal-scope .newsletter-signup-demo-footer > button:focus-visible {\n  outline: 2px solid var(--t-accent);\n  outline-offset: 3px;\n}\n\n@container (max-width: 500px) {\n  .tidal-scope .newsletter-signup-demo-layout {\n    min-width: 0;\n  }\n\n  .tidal-scope .newsletter-signup-demo-footer {\n    align-items: flex-start;\n    flex-direction: column;\n  }\n\n  .tidal-scope .newsletter-signup-demo-footer > button {\n    width: 100%;\n  }\n}\n\n@media (max-width: 390px) {\n  .tidal-scope .newsletter-signup-demo {\n    padding: 10px;\n    background-size: 18px 18px;\n  }\n}\n\n@media (prefers-reduced-motion: reduce) {\n  .tidal-scope .newsletter-signup-demo-footer > button {\n    transition: none;\n  }\n\n  .tidal-scope .newsletter-signup-demo-footer > button:active {\n    transform: none;\n  }\n}";

export function NewsletterSignupDemo() {
  const [email, setEmail] = useState("");
  const [emailError, setEmailError] = useState("");
  const [status, setStatus] = useState<TidalNewsletterSignupStatus>("idle");
  const [statusMessage, setStatusMessage] = useState<ReactNode>(null);
  const [notice, setNotice] = useState(
    "Use sample values only. No newsletter service is connected.",
  );
  const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);
  const emailInput = useRef<HTMLInputElement>(null);
  const statusRegion = useRef<HTMLDivElement>(null);
  const focusEmailOnIdle = useRef(false);
  const [errorFocusVersion, setErrorFocusVersion] = useState(0);

  useEffect(() => () => clearTimeout(timer.current), []);

  useLayoutEffect(() => {
    if (status === "success" && document.activeElement === document.body) {
      statusRegion.current
        ?.querySelector<HTMLButtonElement>("button")
        ?.focus({ preventScroll: true });
    }
    if (status === "error") {
      statusRegion.current?.focus({ preventScroll: true });
      return;
    }
    if (status === "idle" && focusEmailOnIdle.current) {
      focusEmailOnIdle.current = false;
      emailInput.current?.focus({ preventScroll: true });
    }
  }, [errorFocusVersion, status]);

  function cancelPendingForEdit() {
    clearTimeout(timer.current);
    if (status === "pending") {
      setNotice("Local preparation cancelled because the sample changed.");
    } else if (status !== "idle") {
      setNotice("Sample is ready to prepare again locally.");
    }
    setStatus("idle");
    setStatusMessage(null);
  }

  function handleInvalid(event: InvalidEvent<HTMLInputElement>) {
    event.preventDefault();
    clearTimeout(timer.current);
    const message = event.currentTarget.validity.valueMissing
      ? "Add a sample email address."
      : "Use a complete sample email address.";
    setEmailError(message);
    setStatus("error");
    setStatusMessage("Review the sample email before preparing it locally.");
    setNotice("Native email validation stopped local preparation.");
    setErrorFocusVersion((current) => current + 1);
  }

  function handleSubmit(event: FormEvent<HTMLFormElement>) {
    event.preventDefault();
    clearTimeout(timer.current);
    setEmailError("");
    setStatus("pending");
    setStatusMessage("Preparing this sample locally. Nothing is being sent.");
    setNotice("Local preparation is in progress.");
    timer.current = setTimeout(() => {
      setStatus("success");
      setStatusMessage(
        "Sample prepared locally. No signup, message, or subscription was created.",
      );
      setNotice("Local preparation completed without a network request.");
    }, 720);
  }

  function handleReset(event: FormEvent<HTMLFormElement>) {
    if (event.defaultPrevented) return;
    clearTimeout(timer.current);
    setEmail("");
    setEmailError("");
    setStatus("idle");
    setStatusMessage(null);
    setNotice("Sample cleared. No newsletter service is connected.");
    focusEmailOnIdle.current = false;
    emailInput.current?.focus({ preventScroll: true });
  }

  function handleStatusAction(
    current: Exclude<TidalNewsletterSignupStatus, "idle">,
  ) {
    clearTimeout(timer.current);
    if (current === "error") {
      emailInput.current?.focus({ preventScroll: true });
      return;
    }
    setStatus("idle");
    setStatusMessage(null);
    setNotice(
      current === "pending"
        ? "Local preparation cancelled. The sample was not sent or saved."
        : "Edit the sample and prepare it again when ready.",
    );
    focusEmailOnIdle.current = true;
  }

  const statusActionLabel =
    status === "pending"
      ? "Cancel"
      : status === "error"
        ? "Review email"
        : status === "success"
          ? "Edit sample"
          : undefined;

  return (
    <section className="newsletter-signup-demo">
      <div className="newsletter-signup-demo-layout">
        <TidalNewsletterSignup
          title="Useful product notes, once a month."
          description="A focused email block for product updates. This local preview validates and prepares a sample without creating a signup."
          emailLabel="Work email"
          emailDescription="Use a fictional address for this local preview."
          emailError={emailError}
          emailRef={emailInput}
          emailInputProps={{
            value: email,
            placeholder: "name@example.com",
            inputMode: "email",
            onChange: (event: import("react").ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {
              setEmail(event.target.value);
              setEmailError("");
              cancelPendingForEdit();
            },
            onInvalid: handleInvalid,
          }}
          status={status}
          statusMessage={statusMessage}
          statusRef={statusRegion}
          statusActionLabel={statusActionLabel}
          onStatusAction={handleStatusAction}
          submitLabel="Prepare sample"
          pendingLabel="Preparing locally"
          onSubmit={handleSubmit}
          onReset={handleReset}
          consent="Consent and privacy language belongs to the consumer. This preview creates no subscription."
          footer={
            <div className="newsletter-signup-demo-footer">
              <span role="status" aria-live="polite">
                {notice}
              </span>
              <button type="reset">
                <RotateCcw size={14} aria-hidden="true" />
                Clear sample
              </button>
            </div>
          }
        />
      </div>
    </section>
  );
}

export default function AgentExample() {
  return (
    <div className="tidal-scope" data-theme="light" dir="ltr">
      <style>{tidalExampleStyles}</style>
      <NewsletterSignupDemo />
    </div>
  );
}

```

## Gotchas

- The host application owns data, validation, persistence, navigation, and service side effects described by this API.

## Theme and accessibility

{"tokens":["--t-accent","--t-border","--t-border-strong","--t-canvas","--t-danger","--t-display","--t-ease-out","--t-ease-spring","--t-faint","--t-font","--t-ink","--t-line","--t-muted","--t-primary","--t-primary-contrast","--t-radius-card","--t-radius-control","--t-radius-overlay","--t-radius-panel","--t-ring","--t-shadow-lg","--t-shadow-soft","--t-soft","--t-subtle","--t-surface","--t-wash"],"darkMode":true}

{"keyboard":["Tab and Shift+Tab follow the component's native focus order.","Arrow-key behavior follows the exported composite-control implementation."],"aria":"The component wires labels and relationships from consumer-provided visible text or ARIA props; preserve those labels in production.","notes":"Verify focus visibility, text alternatives, contrast, and reduced motion in the final composition."}

title required. Native form attributes/ref are forwarded, including action, method, target, noValidate, onSubmit, and onReset. Optional description, eyebrow, headingLevel, email label/description/error, native emailInputProps, emailRef, consumer-owned idle/pending/error/success status and statusMessage, focusable error statusRef, native status action attributes/ref/callback, submit labels/ref and native submitButtonProps including formAction/formMethod/formTarget/name/value, consent ReactNode, and footer ReactNode. Email uses the form-field registry dependency with fixed type=email, default name=email, autocomplete=email, and required=true unless overridden. Pending only marks aria-busy and disables the submitter. The component performs no request, storage, logging, subscription, consent decision, or backend validation.
