{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"site-footer","type":"registry:block","title":"Site footer","description":"A website footer with link columns and newsletter, a minimal layout, and a large fading Arc mark.","categories":["blocks"],"dependencies":["lucide-react","motion"],"registryDependencies":["https://uiarc.dev/r/arc-motion-tokens.json","https://uiarc.dev/r/button.json","https://uiarc.dev/r/segmented-control.json"],"files":[{"path":"registry/blocks/site-footer/site-footer.tsx","type":"registry:component","target":"@components/arc/blocks/site-footer/site-footer.tsx","content":"\"use client\";\n\nimport { forwardRef, useId, useLayoutEffect, useRef, useState } from \"react\";\nimport type { FormEvent, ReactNode } from \"react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\nimport { ArrowUpRight, Check } from \"lucide-react\";\nimport { Button } from \"../../button/button\";\nimport SegmentedControl from \"../../segmented-control/segmented-control\";\nimport { motionTokens } from \"../../lib/motion-tokens\";\nimport styles from \"./site-footer.module.css\";\n\nexport type SiteFooterVariant = \"columns\" | \"minimal\" | \"logo\";\n\nexport interface SiteFooterLink {\n  label: string;\n  href?: string;\n  /** Opens in a new tab and shows an outward arrow. */\n  external?: boolean;\n}\n\nexport interface SiteFooterColumn {\n  title: string;\n  links: SiteFooterLink[];\n}\n\nexport interface SiteFooterNewsletter {\n  title?: string;\n  description?: string;\n  placeholder?: string;\n  /** Called with a valid address. Throw or reject to show an error; resolve to show the subscribed state. */\n  onSubscribe?: (email: string) => void | Promise<void>;\n}\n\nexport interface SiteFooterProps {\n  /** `columns` pairs a newsletter with link columns, `minimal` is one quiet row, `logo` ends in a large fading Arc mark. */\n  variant?: SiteFooterVariant;\n  brand?: { name: string; href?: string; mark?: ReactNode };\n  /** One short line under the brand. */\n  tagline?: string;\n  columns?: SiteFooterColumn[];\n  /** Links for the minimal variant. Defaults to the first link of each column. */\n  links?: SiteFooterLink[];\n  /** Small links beside the copyright, such as Privacy and Terms. */\n  legal?: SiteFooterLink[];\n  socials?: SiteFooterLink[];\n  /** Newsletter signup. Pass null to hide it. */\n  newsletter?: SiteFooterNewsletter | null;\n  /** A system status link. Pass null to hide it. */\n  status?: { label: string; tone?: \"success\" | \"warning\" | \"danger\"; href?: string } | null;\n  /** Year in the copyright line. */\n  year?: number;\n  /** Called for every link that is pressed. Links without an href render as buttons and only call this. */\n  onNavigate?: (link: SiteFooterLink) => void;\n  className?: string;\n}\n\ntype Bezier = [number, number, number, number];\nconst enter = [...motionTokens.ease.enter] as Bezier;\n\nexport const siteFooterExampleColumns: SiteFooterColumn[] = [\n  { title: \"Product\", links: [{ label: \"Components\" }, { label: \"Blocks\" }, { label: \"Templates\" }, { label: \"Pricing\" }] },\n  { title: \"Resources\", links: [{ label: \"Documentation\" }, { label: \"Changelog\" }, { label: \"Guides\" }, { label: \"Figma kit\", external: true }] },\n  { title: \"Company\", links: [{ label: \"About\" }, { label: \"Customers\" }, { label: \"Careers\" }, { label: \"Contact\" }] },\n];\nconst exampleLegal: SiteFooterLink[] = [{ label: \"Privacy\" }, { label: \"Terms\" }, { label: \"Licenses\" }];\nconst exampleSocials: SiteFooterLink[] = [{ label: \"X\", external: true }, { label: \"GitHub\", external: true }, { label: \"LinkedIn\", external: true }];\nconst EMAIL = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]{2,}$/;\n\nfunction FooterLink({ link, onNavigate, className }: { link: SiteFooterLink; onNavigate?: (link: SiteFooterLink) => void; className?: string }) {\n  const content = <>{link.label}{link.external && <ArrowUpRight className={styles.external} size={13} strokeWidth={2} aria-hidden=\"true\" />}</>;\n  const onClick = () => onNavigate?.(link);\n  if (link.href) return <a className={className ?? styles.link} href={link.href} onClick={onClick} {...(link.external ? { target: \"_blank\", rel: \"noopener noreferrer\" } : {})}>{content}</a>;\n  return <button type=\"button\" className={className ?? styles.link} onClick={onClick}>{content}</button>;\n}\n\nfunction ArcMark({ className }: { className?: string }) {\n  return <svg className={className} viewBox=\"0 0 64 64\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"5.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n    <path d=\"M9 48V29C9 15 19 7 32 7s23 8 23 22v19\" />\n    <path d=\"M20 48V31c0-8 5-13 12-13s12 5 12 13v17\" />\n    <path d=\"M32 38v10\" />\n  </svg>;\n}\n\n/** Email signup that validates in place, keeps its width while the button morphs, and confirms without a toast. */\nfunction Newsletter({ title, description, placeholder = \"you@example.com\", onSubscribe }: SiteFooterNewsletter) {\n  const id = useId();\n  const reduced = !!useReducedMotion();\n  const [email, setEmail] = useState(\"\");\n  const [state, setState] = useState<\"idle\" | \"loading\" | \"done\">(\"idle\");\n  const [error, setError] = useState<string | null>(null);\n  const [touched, setTouched] = useState(false);\n\n  const validate = (value: string) => !value.trim() ? \"Enter your email address\" : EMAIL.test(value.trim()) ? null : \"That email doesn't look right\";\n\n  async function submit(event: FormEvent) {\n    event.preventDefault();\n    if (state !== \"idle\") return;\n    setTouched(true);\n    const problem = validate(email);\n    setError(problem);\n    if (problem) return;\n    setState(\"loading\");\n    try {\n      await (onSubscribe ? onSubscribe(email.trim()) : new Promise(resolve => setTimeout(resolve, 900)));\n      setState(\"done\");\n    } catch {\n      setState(\"idle\");\n      setError(\"We couldn't subscribe you. Try again in a moment\");\n    }\n  }\n\n  const message = state === \"done\" ? `Check ${email.trim()} to confirm` : error ?? description;\n  const tone = state === \"done\" ? \"success\" : error ? \"error\" : \"hint\";\n\n  return <form className={styles.newsletter} onSubmit={submit} noValidate aria-labelledby={title ? `${id}-title` : undefined}>\n    {title && <h2 id={`${id}-title`} className={styles.newsletterTitle}>{title}</h2>}\n    <div className={styles.newsletterRow} data-invalid={error ? \"\" : undefined} data-done={state === \"done\" ? \"\" : undefined}>\n      <label className={styles.srOnly} htmlFor={`${id}-email`}>Email address</label>\n      <input\n        id={`${id}-email`}\n        className={styles.newsletterInput}\n        type=\"email\"\n        inputMode=\"email\"\n        autoComplete=\"email\"\n        placeholder={placeholder}\n        value={email}\n        readOnly={state !== \"idle\"}\n        aria-invalid={error ? true : undefined}\n        aria-describedby={`${id}-message`}\n        onChange={event => { setEmail(event.target.value); if (touched) setError(validate(event.target.value)); }}\n        onBlur={() => { if (email) { setTouched(true); setError(validate(email)); } }}\n      />\n      <Button type=\"submit\" size=\"sm\" variant=\"primary\" loading={state === \"loading\"} className={styles.newsletterButton} aria-disabled={state === \"done\" || undefined}>\n        {state === \"done\" ? <><Check size={15} strokeWidth={2.25} aria-hidden=\"true\" />Subscribed</> : \"Subscribe\"}\n      </Button>\n    </div>\n    <div className={styles.messageSlot} id={`${id}-message`} aria-live=\"polite\">\n      <AnimatePresence initial={false} mode=\"popLayout\">\n        {message && <motion.p key={message} className={styles.message} data-tone={tone} role={tone === \"error\" ? \"alert\" : undefined}\n          initial={reduced ? { opacity: 0 } : { opacity: 0, y: 4, filter: `blur(${motionTokens.blur.subtle}px)` }}\n          animate={{ opacity: 1, y: 0, filter: \"blur(0px)\" }}\n          exit={reduced ? { opacity: 0, transition: { duration: 0 } } : { opacity: 0, y: -4, filter: `blur(${motionTokens.blur.subtle}px)`, transition: { duration: motionTokens.duration.instant } }}\n          transition={{ duration: reduced ? 0 : motionTokens.duration.standard, ease: enter }}>{message}</motion.p>}\n      </AnimatePresence>\n    </div>\n  </form>;\n}\n\n/**\n * A website footer in three layouts: link columns with a newsletter signup, a single quiet row, and a closing\n * variant where the Arc arch rises in, oversized and cropped by the bottom edge, fading into the page.\n */\nexport const SiteFooter = forwardRef<HTMLElement, SiteFooterProps>(function SiteFooter({\n  variant = \"columns\",\n  brand = { name: \"Arc\" },\n  tagline = \"Interface components that move with intent.\",\n  columns = siteFooterExampleColumns,\n  links,\n  legal = exampleLegal,\n  socials = exampleSocials,\n  newsletter = { title: \"Get the monthly release notes\", description: \"One email a month. Unsubscribe anytime.\" },\n  status = { label: \"All systems normal\", tone: \"success\" },\n  year = new Date().getFullYear(),\n  onNavigate,\n  className,\n}, ref) {\n  const reduced = !!useReducedMotion();\n  const gradientId = useId().replace(/:/g, \"\");\n  const brandNode = <FooterLink link={{ label: brand.name, href: brand.href }} onNavigate={onNavigate} className={styles.brand} />;\n  const brandWithMark = <span className={styles.brandRow}>{brand.mark ?? <ArcMark className={styles.brandMark} />}{brandNode}</span>;\n  const statusNode = status && (status.href\n    ? <a className={styles.status} href={status.href} data-tone={status.tone ?? \"success\"} onClick={() => onNavigate?.({ label: status.label, href: status.href })}><span className={styles.statusDot} aria-hidden=\"true\" />{status.label}</a>\n    : <button type=\"button\" className={styles.status} data-tone={status.tone ?? \"success\"} onClick={() => onNavigate?.({ label: status.label })}><span className={styles.statusDot} aria-hidden=\"true\" />{status.label}</button>);\n  const socialNode = socials.length > 0 && <ul className={styles.inline} aria-label=\"Social\">{socials.map(link => <li key={link.label}><FooterLink link={link} onNavigate={onNavigate} /></li>)}</ul>;\n  const legalRow = <div className={styles.bottom}>\n    <div className={styles.bottomStart}>\n      <span className={styles.copyright}>© {year} {brand.name}</span>\n      {legal.length > 0 && <ul className={styles.inline} aria-label=\"Legal\">{legal.map(link => <li key={link.label}><FooterLink link={link} onNavigate={onNavigate} /></li>)}</ul>}\n    </div>\n    <div className={styles.bottomEnd}>{statusNode}{socialNode}</div>\n  </div>;\n  const columnNav = <nav className={styles.columns} aria-label=\"Footer\">\n    {columns.map(column => <div key={column.title} className={styles.column}>\n      <h2>{column.title}</h2>\n      <ul>{column.links.map(link => <li key={link.label}><FooterLink link={link} onNavigate={onNavigate} /></li>)}</ul>\n    </div>)}\n  </nav>;\n\n  if (variant === \"minimal\") {\n    const rowLinks = links ?? columns.map(column => column.links[0]).filter((link): link is SiteFooterLink => Boolean(link)).concat(legal.slice(0, 2));\n    return <footer ref={ref} className={[styles.footer, styles.minimal, className].filter(Boolean).join(\" \")}>\n      <div className={styles.minimalRow}>\n        {brandWithMark}\n        <nav aria-label=\"Footer\"><ul className={styles.inline}>{rowLinks.map(link => <li key={link.label}><FooterLink link={link} onNavigate={onNavigate} /></li>)}</ul></nav>\n      </div>\n      <div className={styles.minimalRow}>\n        <span className={styles.copyright}>© {year} {brand.name}. {tagline}</span>\n        <div className={styles.bottomEnd}>{statusNode}{socialNode}</div>\n      </div>\n    </footer>;\n  }\n\n  return <footer ref={ref} className={[styles.footer, variant === \"logo\" ? styles.logo : \"\", className].filter(Boolean).join(\" \")}>\n    <div className={styles.top}>\n      <div className={styles.intro}>\n        {brandWithMark}\n        {tagline && <p className={styles.tagline}>{tagline}</p>}\n        {newsletter && variant === \"columns\" && <Newsletter {...newsletter} />}\n      </div>\n      {columnNav}\n    </div>\n    {legalRow}\n    {variant === \"logo\" && <motion.div className={styles.markStage} aria-hidden=\"true\"\n      initial={reduced ? false : { opacity: 0, y: 40 }}\n      whileInView={{ opacity: 1, y: 0 }}\n      viewport={{ once: true, amount: .3 }}\n      transition={{ duration: reduced ? 0 : .9, ease: enter }}>\n      {/* The top of the arch, drawn oversized and cropped by its viewBox, in the brand gradient and fading toward the bottom edge. */}\n      <svg className={styles.bigMark} viewBox=\"0 3.5 64 30\" fill=\"none\" strokeWidth=\"3.4\" strokeLinecap=\"round\" strokeLinejoin=\"round\" preserveAspectRatio=\"xMidYMin meet\">\n        <defs>\n          <linearGradient id={gradientId} x1=\"0\" y1=\"0\" x2=\"1\" y2=\"0\">\n            <stop offset=\"0\" style={{ stopColor: \"var(--arc-gradient-from)\" }} />\n            <stop offset=\"1\" style={{ stopColor: \"var(--arc-gradient-to)\" }} />\n          </linearGradient>\n        </defs>\n        <g stroke={`url(#${gradientId})`}>\n          <path d=\"M9 48V29C9 15 19 7 32 7s23 8 23 22v19\" />\n          <path d=\"M20 48V31c0-8 5-13 12-13s12 5 12 13v17\" />\n          <path d=\"M32 38v10\" />\n        </g>\n      </svg>\n    </motion.div>}\n  </footer>;\n});\n\nSiteFooter.displayName = \"SiteFooter\";\n\nconst variantOptions = [{ value: \"columns\", label: \"Columns\" }, { value: \"minimal\", label: \"Minimal\" }, { value: \"logo\", label: \"Logo\" }];\n\n/** Preview: the footer with a switch between its three layouts and a note of the last link pressed. */\nexport function SiteFooterBlock({ variant: initial = \"columns\" }: { variant?: SiteFooterVariant }) {\n  const [variant, setVariant] = useState<SiteFooterVariant>(initial);\n  const [last, setLast] = useState<string | null>(null);\n  const reduced = !!useReducedMotion();\n  const contentRef = useRef<HTMLDivElement>(null);\n  const [height, setHeight] = useState<number | null>(null);\n  // The frame springs between layout heights instead of snapping; the new layout fades in where it sits.\n  useLayoutEffect(() => {\n    const node = contentRef.current;\n    if (!node) return;\n    setHeight(node.offsetHeight);\n    if (typeof ResizeObserver === \"undefined\") return;\n    const observer = new ResizeObserver(() => setHeight(node.offsetHeight));\n    observer.observe(node);\n    return () => observer.disconnect();\n  }, [variant]);\n  return <div className={styles.preview}>\n    <SegmentedControl label=\"Footer layout\" options={variantOptions} value={variant} onValueChange={value => setVariant(value as SiteFooterVariant)} />\n    <div className={styles.frame}>\n      <motion.div className={styles.frameBody} initial={false} animate={{ height: height ?? \"auto\" }} transition={reduced ? { duration: 0 } : motionTokens.spring.smooth}>\n        <motion.div ref={contentRef} key={variant} initial={reduced ? false : { opacity: 0 }} animate={{ opacity: 1 }} transition={{ duration: motionTokens.duration.standard, ease: enter }}>\n          <SiteFooter variant={variant} onNavigate={link => setLast(link.label)} />\n        </motion.div>\n      </motion.div>\n    </div>\n    <p className={styles.srOnly} aria-live=\"polite\">{last ? `Opened ${last}` : \"\"}</p>\n  </div>;\n}\n\nexport default SiteFooterBlock;\n"},{"path":"registry/blocks/site-footer/site-footer.module.css","type":"registry:component","target":"@components/arc/blocks/site-footer/site-footer.module.css","content":".footer { --footer-pad: var(--space-6); position: relative; container: site-footer / inline-size; overflow: hidden; border-top: 1px solid var(--border); padding: var(--space-12) var(--footer-pad) var(--space-6); background: var(--background); color: var(--foreground); font-family: var(--font-body); letter-spacing: var(--tracking-body); }\n.srOnly { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }\n\n.top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: var(--space-12); }\n.intro { display: grid; align-content: start; gap: var(--space-3); min-width: 0; }\n.brandRow { display: inline-flex; align-items: center; gap: var(--space-2); }\n.brandMark { width: 22px; height: 22px; flex: none; color: var(--foreground); }\n.brand { border: 0; padding: 0; background: none; color: var(--foreground); font: inherit; font-size: var(--text-base); font-weight: 500; text-decoration: none; cursor: pointer; }\n.tagline { max-width: 320px; margin: 0; color: var(--text-secondary); font-size: var(--text-sm); line-height: var(--leading-body); }\n\n.columns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-6); }\n.column h2 { margin: 0 0 var(--space-3); font-size: var(--text-sm); font-weight: 500; }\n.column ul, .inline { margin: 0; padding: 0; list-style: none; }\n.column ul { display: grid; gap: var(--space-2); }\n.link { display: inline-flex; align-items: center; gap: 3px; border: 0; padding: 2px 0; background: none; color: var(--text-secondary); font: inherit; font-size: var(--text-sm); text-align: left; text-decoration: none; cursor: pointer; transition: color var(--duration-fast) var(--ease-standard); }\n.link:active, .link:focus-visible { color: var(--foreground); }\n.external { color: var(--text-muted); transition: transform var(--duration-fast) var(--ease-standard); }\n@media (hover: hover) and (pointer: fine) {\n  .link:hover { color: var(--foreground); }\n  .link:hover .external { transform: translate(1px, -1px); }\n}\n\n/* Newsletter: input and button share one shell; the shell carries validation state with its border only. */\n.newsletter { display: grid; gap: var(--space-2); max-width: 400px; margin-top: var(--space-5); }\n.newsletterTitle { margin: 0; font-size: var(--text-sm); font-weight: 500; }\n.newsletterRow { display: flex; height: var(--control-height-md); align-items: center; gap: var(--space-2); border: 1px solid var(--border); border-radius: var(--radius-control); padding: 3px 3px 3px var(--space-4); background: var(--surface); transition: border-color var(--duration-fast) var(--ease-standard); }\n.newsletterRow:focus-within { border-color: var(--border-strong); }\n.newsletterRow[data-invalid] { border-color: var(--danger); }\n.newsletterInput { width: 100%; min-width: 0; flex: 1; border: 0; padding: 0; background: none; color: var(--foreground); font: inherit; font-size: var(--text-sm); }\n.newsletterInput::placeholder { color: var(--text-muted); }\n.newsletterRow[data-done] .newsletterInput { color: var(--text-secondary); }\n.newsletterButton { flex: none; border-radius: calc(var(--radius-control) - 3px); }\n.messageSlot { position: relative; min-height: 20px; }\n.message { margin: 0; color: var(--text-muted); font-size: var(--text-xs); line-height: 20px; }\n.message[data-tone=\"error\"] { color: var(--danger); }\n.message[data-tone=\"success\"] { color: var(--success); }\n\n.bottom { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3) var(--space-6); margin-top: var(--space-12); border-top: 1px solid var(--border-subtle); padding-top: var(--space-5); }\n.bottomStart, .bottomEnd { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-5); }\n.inline { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-4); }\n.copyright { color: var(--text-muted); font-size: var(--text-sm); }\n.status { display: inline-flex; align-items: center; gap: var(--space-2); border: 0; padding: 2px 0; background: none; color: var(--text-secondary); font: inherit; font-size: var(--text-sm); text-decoration: none; cursor: pointer; }\n.statusDot { --tone: var(--success); width: 7px; height: 7px; border-radius: 50%; background: var(--tone); box-shadow: 0 0 0 3px color-mix(in oklab, var(--tone) 18%, transparent); }\n.status[data-tone=\"warning\"] .statusDot { --tone: var(--warning); }\n.status[data-tone=\"danger\"] .statusDot { --tone: var(--danger); }\n@media (hover: hover) and (pointer: fine) { .status:hover { color: var(--foreground); } }\n\n/* Minimal: two quiet rows. */\n.minimal { padding-block: var(--space-8) var(--space-6); }\n.minimalRow { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3) var(--space-6); }\n.minimalRow + .minimalRow { margin-top: var(--space-6); border-top: 1px solid var(--border-subtle); padding-top: var(--space-5); }\n\n/* Logo: the arch closes the page, cropped by the bottom edge and fading out in the brand gradient. */\n.logo { padding-bottom: 0; }\n.markStage { margin: var(--space-10) calc(var(--footer-pad) * -1) 0; -webkit-mask-image: linear-gradient(to bottom, #000 18%, transparent 96%); mask-image: linear-gradient(to bottom, #000 18%, transparent 96%); pointer-events: none; }\n.bigMark { display: block; width: 100%; height: auto; }\n\n@container site-footer (max-width: 760px) {\n  .top { grid-template-columns: minmax(0, 1fr); gap: var(--space-10); }\n}\n@container site-footer (max-width: 520px) {\n  .columns { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-8) var(--space-4); }\n  .newsletter { max-width: none; }\n  .bottom { flex-direction: column; align-items: flex-start; }\n}\n\n.preview { display: grid; width: 100%; justify-items: center; gap: var(--space-4); }\n.frame { width: 100%; overflow: hidden; border: 1px solid var(--border); border-radius: 20px; background: var(--background); }\n.frameBody { overflow: hidden; }\n.frame .footer { border-top: 0; }\n.previewNote { min-height: 20px; margin: 0; color: var(--text-muted); font-size: var(--text-xs); }\n\n@media (prefers-reduced-motion: reduce) {\n  .link, .external, .newsletterRow { transition: none; }\n}\n"}],"docs":"Use this as a starting point and replace the sample data with your own.","meta":{"tier":"free","kind":"block","builtFrom":["Motion"],"docs":"https://uiarc.dev/components/blocks/site-footer"}}