@molecule/app-newsletter-signup-solid
Feature · newsletter-signup · App (browser) · v1.1.4 · Apache-2.0
Email + subscribe button with success state for newsletter capture
npm install @molecule/app-newsletter-signup-solidHow it works
@molecule/app-newsletter-signup-solid is a ready-made newsletter-signup feature for the app (browser) side. It composes the core interfaces it needs, so it works with whichever providers your app has bonded.
import { NewsletterSignup } from '@molecule/app-newsletter-signup-solid'
declare const api: { subscribe: (email: string) => Promise<void> }
export function Subscribe() {
return (
<NewsletterSignup
title="Stay in the loop"
description="Get weekly updates delivered to your inbox."
onSubscribe={async (email) => {
await api.subscribe(email)
}}
layout="inline"
successContent={<p>Thanks for subscribing!</p>}
/>
)
}Works with: @molecule/app-solid, @molecule/app-ui, @molecule/app-ui-solid
Reference
Solid email subscribe form.
Exports NewsletterSignup with inline + stacked layouts. Tracks its own
submitting / error / success state; the app owns the subscription
side-effect via onSubscribe. It is the Solid counterpart of
@molecule/app-newsletter-signup-react: same props (React names) and the
same DOM for the same input.
Auto-generated, AI-first package reference for the molecule.dev ecosystem. It is written to be read by coding agents as much as by people, and is generated from this package's source — edit
src/index.tsJSDoc, not this file.
Quick Start
import { NewsletterSignup } from '@molecule/app-newsletter-signup-solid'
declare const api: { subscribe: (email: string) => Promise<void> }
export function Subscribe() {
return (
<NewsletterSignup
title="Stay in the loop"
description="Get weekly updates delivered to your inbox."
onSubscribe={async (email) => {
await api.subscribe(email)
}}
layout="inline"
successContent={<p>Thanks for subscribing!</p>}
/>
)
}
Type
feature
Installation
npm install @molecule/app-newsletter-signup-solid @molecule/app-solid @molecule/app-ui @molecule/app-ui-solid solid-js
API
Interfaces
NewsletterSignupProps
Props for NewsletterSignup — the same props (React names) as @molecule/app-newsletter-signup-react.
interface NewsletterSignupProps {
/** Called with the email on submit. Return a Promise to block double-submit. */
onSubscribe: (email: string) => void | Promise<void>
/** Optional title above the form. */
title?: JSX.Element
/** Optional supporting copy under the title. */
description?: JSX.Element
/** Placeholder for the email input. */
placeholder?: string
/** Submit-button label. */
buttonLabel?: JSX.Element
/** Rendered after successful subscription. */
successContent?: JSX.Element
/** Layout — `'inline'` default (input + button on one row) or `'stacked'`. */
layout?: 'inline' | 'stacked'
/** Extra classes. */
className?: string
}
Functions
NewsletterSignup(props)
Email + subscribe button widget. Tracks its own submitting/error/success
state. Apps own the actual subscription side-effect via onSubscribe.
Always pass successContent — without it a successful submit only clears
the input and re-renders the empty form. Return a Promise from onSubscribe
so double-submits are blocked while in flight; a rejected Promise renders
the error's message verbatim below the form.
function NewsletterSignup(props: NewsletterSignupProps): JSX.Element
props— Component props (seeNewsletterSignupProps).
Returns: The rendered newsletter signup form.
Injection Notes
Requirements
Peer dependencies:
@molecule/app-solid^3.14.0 || ^4.0.0@molecule/app-ui^1.0.1@molecule/app-ui-solid^1.1.0solid-js^1.8.0
Runtime Dependencies
@molecule/app-solid@molecule/app-ui@molecule/app-ui-solidsolid-js
Requires a wired ClassMap bond and @molecule/app-solid's i18n provider
above it — getClassMap() and useTranslation() both throw before wiring.
Pair with @molecule/app-locales-newsletter-signup for the placeholder /
button / label / error strings in 79 languages.
ALWAYS pass successContent — without it a successful submit only clears
the input and re-renders the empty form (no built-in "thanks" message).
Return a Promise from onSubscribe so double-submits are blocked while in
flight; a rejected Promise renders the error's message verbatim below the
form, so throw user-readable (ideally pre-translated) messages.
Translations
Translation strings are provided by @molecule/app-locales-newsletter-signup.