An email signup banner that validates inline and morphs into a thank-you message on success.
Interaction Type
Enter an email and submit. Invalid input shows an inline error linked with aria-describedby, and success crossfades the form into a confirmation.
Props
Options you can pass to customize this component.
titleHeading text.
descriptionSupporting copy.
successMessageShown after a successful signup.
emailLabelScreen reader label of the input.
placeholderInput placeholder.
submitLabelSubmit button label.
invalidMessageError shown for an invalid email.
onSubscribeCalled with the email on a valid submit.
Installation
How to use
<BannerSubscribe
onSubscribe={async (email) => {
await fetch('/api/subscribe', { method: 'POST', body: email })
}}
/>Source Code
Click the code icon in the top-right corner to view the source code.
License & Usage
// No code loaded.