# NewsletterForm

> A blog's sign-up form as composable parts: an email field and a submit button that sit side by side when the form has room and stack on a narrow one, measured from the form's own width so it fits a sidebar and a page column alike.

```ts
import { NewsletterForm } from "@sdxc/ui/blog";
```

Renders a `method="post"` form laying out its parts in a wrapping row: the
NewsletterForm.Field fills the row beside the NewsletterForm.Submit, and
once the pair no longer fits, the button drops below and spans the form. The server answers
the post with its own confirmation page, so the form works with script off.

## Examples

```tsx
<NewsletterForm action="/subscribe">
	<NewsletterForm.Field>
		<NewsletterForm.Label>Email address</NewsletterForm.Label>
		<NewsletterForm.Input />
	</NewsletterForm.Field>
	<NewsletterForm.Submit>Subscribe</NewsletterForm.Submit>
</NewsletterForm>
```

## Props

| Prop | Type | Description |
| --- | --- | --- |
| `action` | `string` | The blog's sign-up address, which the form posts to. |

Also accepts everything in `Omit<TagProps<"form">, "method" | "action">`.


### NewsletterForm.Field

The label and its control stacked, taking the row's free width beside the button down to a shared minimum, past which the row wraps.

Also accepts everything in `TagProps<"div">`.


### NewsletterForm.Label

The field's visible label, tied to the form's email control; inside a NewsletterForm it points at the form's control whatever `htmlFor` says.

Also accepts everything in `Label.Props`.


### NewsletterForm.Input

The required email control the form posts, named `email` and filled in by the browser's saved address; set `name` or `placeholder` to change either.

| Prop | Type | Description |
| --- | --- | --- |
| `color?` | `Input.Color` | The focus ring's colour role. |

Also accepts everything in `Omit<TagProps<"input">, "type" | "role">`.


### NewsletterForm.Submit

The form's submit button in the brand colour, growing to fill its line once it wraps below the field.

Also accepts everything in `Button.Props`.

