DlNewsletter

Collect newsletter subscriptions with a styled form

The DlNewsletter inline component renders a styled subscription form wired to your newsletter adapter. It uses Nuxt UI form controls and provides a smooth UX with validation, loading state, and toasts.

Features

  • ✉️ email input with built-in native validation
  • 🔄 loading state and feedback toasts
  • 🔌 integrates with app-configured newsletter adapter
  • 🧩 theme-friendly visual adjustments
  • 📱 responsive layout

Usage

Use :dl-newsletter as an inline component to render the subscription form. Make sure a newsletter adapter is configured in app.config.ts.

:dl-newsletter

Result:

With custom button label

Set the buttonLabel prop to customize the submit button text.

:dl-newsletter{button-label="Join the list"}

Result:

Configuration

DlNewsletter expects a newsletter adapter function to be defined in your app.config.ts. You can provide it under dl.adapters.newsletter. If no newsletter adapter is configured, the component will not work and report error when used.

On how to create and use adapters you can read here.

Props

Here are the properties you can use with the DlNewsletter component. Each property should be set on an individual component instance; they do not affect the global configuration. More about defining properties in MDC components you can read here.

nametypedefaultdescription
lazybooleanundefined

Whether to lazy load the component.

buttonLabelstring'Subscribe'

Label for the submit button.

inputPlaceholderstringstring

Placeholder text for the email input.

iuiRecord<string, string>undefined

Special property dedicated to inline components, can be used to add TW classes for certain component markup elements.

Styling

Styling from Markdown

Every DocLayer component can be styled directly within your Markdown file using dedicated slot/property configuration. This allows you to customize the appearance of the component's markup elements without modifying global styles. More about components styling you can read here.

Below you'll find the default set of Tailwind classes for the component's dedicated markup elements.

<script lang="ts">const ui = defineDoclayerComponentUi({  base: ['grid', 'grid-cols-12', 'mb-20'],  container: [    'u-space-p/2',    'u-border-color',    'u-background-color',    'border',    'u-border-radius',    'col-span-12',    'md:col-span-8',    'md:col-start-3',  ],  form: ['grid', 'grid-cols-12', 'items-center', 'justify-center', 'gap-2', 'w-full'],  fieldset: ['col-span-9', 'items-center'],  input: ['w-full', 'pl-12', 'border-0', 'outline-0'],  button: ['u-space-px', 'u-space-m/2', 'col-span-3', 'justify-center', 'h-12', 'md:min-w-[7.5rem]'],});</script>