Skip to main content

Footer Block

Footer is a site footer built on MUI Stack and rendered as a <footer> by default, with logo, content, and copyright regions on a primary-colored bar.

Installation

npm install @nodeblocks/frontend-footer-block

What You Need

ItemWhy it matters
logoSrcImage URL for Footer.Logo
contentMain footer body (links, text, or custom JSX)
copyrightCopyright or legal line (ReactNode, e.g. <>© 2024 …</>)
Composition modes

Pass logoSrc, content, and copyright on Footer to render the default blocks (Footer.Logo, Footer.Content, Footer.Copyright). Use compound children to replace a block’s markup (children on Footer.Content and Footer.Copyright wins over the matching root prop). Use a function child with blocks and blockOrder to add sections or change order.

Code Examples

Live Editor
function Example() {
  const footerLinks = (
    <div style={{display: 'flex', flexDirection: 'column', gap: 8}}>
      <a href="#about" style={{color: 'inherit'}}>
        About Us
      </a>
      <a href="#contact" style={{color: 'inherit'}}>
        Contact Us
      </a>
    </div>
  );

  return (
    <Footer
      logoSrc="https://docs.nodeblocks.dev/img/icon-small.png"
      content={footerLinks}
      copyright={<>© 2024 Nodeblocks.</>}
    />
  );
}
Result
Loading...

Important Props

Core Props

PropTypeRequiredDefaultDescription
logoSrcstringYes-URL for the footer logo (Footer.Logo uses src or this value)
contentReactNodeYes-Main footer body (links, text, or custom JSX)
copyrightReactNodeYes-Copyright or legal notice

Content Props

Set logoSrc, content, and copyright on the root. Subcomponents read them from context unless you pass local props or children (compound mode).

ComponentPropTypeRequiredDefaultDescription
LogosrcstringNoRoot logoSrcLogo image URL; uses src when set, otherwise logoSrc
LogoaltstringNoFooter logoImage alt text
LogologoSrcstringNoRoot logoSrcOverrides context URL for this block
LogoBoxProps<'img'>No-Other img props (className, sx, etc.)
ContentchildrenReactNodeNoRoot contentContent markup (children ?? content)
ContentcontentReactNodeNoRoot contentOverrides context for this block
CopyrightchildrenReactNodeNoRoot copyrightCopyright markup (children ?? copyright)
CopyrightcopyrightReactNodeNoRoot copyrightOverrides context for this block

Logo, Content, and Copyright are Footer.Logo, Footer.Content, and Footer.Copyright.

Layout and Composition Props

PropTypeRequiredDefaultDescription
childrenBlocksOverride | ReactNodeNoundefinedCompound subcomponents or function override returning blocks and blockOrder
classNamestringNoundefinedClass name for the root container (nbb-footer is applied by default)
sxSxPropsNoundefinedMUI system styles for the root container

Footer inherits StackProps (except children and content), including spacing (default { xs: 2, sm: 4 }), direction (default { xs: 'column', sm: 'row' }), and id. Root uses component="footer", backgroundColor: primary.main, color: primary.contrastText, and responsive padding. Render order is logo, content, copyright; defaultBlockOrder is logo, content, copyright.

Default UI Blocks

BlockBuilt onNotes
Footer (root)Stack (component="footer")Primary bar; direction column (xs) / row (sm+)
Footer.LogoBox (component="img")alt default Footer logo; src falls back to logoSrc
Footer.ContentBoxflex: 1, typography: body2
Footer.CopyrightBoxtypography: body2

TypeScript

import { Footer } from '@nodeblocks/frontend-footer-block';
import type { ReactNode } from 'react';

type FooterConfig = {
logoSrc: string;
content: ReactNode;
copyright: ReactNode;
};

const config: FooterConfig = {
logoSrc: 'https://docs.nodeblocks.dev/img/icon-small.png',
content: (
<a href="#about" style={{ color: 'inherit' }}>
About Us
</a>
),
copyright: <>© 2024 Nodeblocks.</>,
};

<Footer {...config} />;