Footer — Newsletter
nswds-ui/footer-newsletterFreeBlock
Link columns beside a labelled email subscription form built on Field, Input and Button.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/digitalnsw/nswds-ui/main/apps/registry/public/r/footer-newsletter.jsonSource
1'use client'23import type * as React from 'react'45import { Button } from '@/components/button'6import { Field, FieldDescription, FieldLabel } from '@/components/field'7import { Footer, FooterNav, FooterNavColumn } from '@/components/footer'8import { Input } from '@/components/input'9import { IconMail } from '@/icons/mail'1011// ── Sample content — replace with your service's own ────────────────────────12const columnsSample = [13 {14 heading: 'Services',15 links: [16 { name: 'Apply for a licence', href: '#licence' },17 { name: 'Pay a fine', href: '#fine' },18 { name: 'Book an appointment', href: '#appointment' },19 ],20 },21 {22 heading: 'About',23 links: [24 { name: 'Who we are', href: '#about' },25 { name: 'Our strategy', href: '#strategy' },26 { name: 'Careers', href: '#careers' },27 ],28 },29]3031const legalLinksSample = [32 { name: 'Accessibility', href: '#accessibility' },33 { name: 'Privacy', href: '#privacy' },34 { name: 'Copyright', href: '#copyright' },35]3637const departmentSample = 'Digital NSW, Department of Customer Service'3839type FooterNewsletterProps = Omit<React.ComponentProps<typeof Footer>, 'children'> & {40 columns?: typeof columnsSample41 /** Called with the submitted email. Wire this to your subscription service. */42 onSubscribe?: (email: string) => void43}4445/**46 * Link columns beside an email subscription form. Use for services that47 * publish updates people opt into — grant rounds, policy changes, alerts.48 *49 * The form is a worked example: it prevents the default submit and hands the50 * address to `onSubscribe`. Replace that with your own submission, and note51 * that collecting an email address makes this a collection point under the52 * PPIP Act — your privacy collection notice belongs next to the field.53 *54 * The label is a real `FieldLabel` inside a `Field`, so Base UI associates it55 * with the input and generates per-instance ids; two of these on one page will56 * not collide. Do not swap it for a placeholder — placeholders disappear on57 * input and are not an accessible name.58 */59export function FooterNewsletter({60 columns = columnsSample,61 legalLinks = legalLinksSample,62 department = departmentSample,63 onSubscribe,64 ...props65}: FooterNewsletterProps) {66 function handleSubmit(event: React.FormEvent<HTMLFormElement>) {67 event.preventDefault()68 const data = new FormData(event.currentTarget)69 const email = data.get('email')70// … truncated
What it pulls in
Other registry items
Files it writes
More from @nswds/ui
All 46 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Footer — Collapsible Site Mapfooter-accordion | @nswds/ui | Blocks | Free | no deps | |
| Footer — Compact Barfooter-compact | @nswds/ui | Blocks | Free | no deps | |
| Footer — Contact Detailsfooter-contact | @nswds/ui | Blocks | Free | no deps | |
| Footer — Call to Actionfooter-cta | @nswds/ui | Blocks | Free | no deps | |
| Footer — Simple Centredfooter-simple-centred | @nswds/ui | Blocks | Free | no deps | |
| Footer — Site Mapfooter-sitemap | @nswds/ui | Blocks | Free | no deps | |
| Footer — Site Map with Brandfooter-sitemap-brand | @nswds/ui | Blocks | Free | no deps | |
| Forgot Password Formforgot-password-form | @nswds/ui | Blocks | Free | no deps |
