How To Use Block
HowToUse is a marketing steps section built on MUI with a centered header, a row of step cards connected by arrows, and a footer call-to-action link button.
Installation
- npm
- yarn
- pnpm
- bun
npm install @nodeblocks/frontend-how-to-use-block
yarn add @nodeblocks/frontend-how-to-use-block
pnpm add @nodeblocks/frontend-how-to-use-block
bun add @nodeblocks/frontend-how-to-use-block
What You Need
| Item | Why it matters |
|---|---|
subtitle | Large headline |
headerContent | Supporting label above the headline |
cardList | Content for step cards |
message | Optional footer line above the CTA |
linkHref | href for the footer contained button |
linkContent | Label on the footer button |
Pass header copy, step cards, and CTA text from your page or CMS. Each card needs an MUI icon, headerContent, and body text as children. Provide cards via cardList on the root, or compose HowToUse.CardList children directly.
Code Examples
- Quick Start
- Compound Components
- Block Override
function Example() { const cardList = [ <HowToUse.Card key="apply" icon={EditOutlined} headerContent="Apply"> Create your account and tell us about your skills and experience. </HowToUse.Card>, <HowToUse.Card key="account" icon={AccountBoxOutlined} headerContent="Set up your profile"> Add your work history, portfolio links, and preferences. </HowToUse.Card>, <HowToUse.Card key="post" icon={AddToQueue} headerContent="Start matching"> Browse opportunities and apply to roles that fit your goals. </HowToUse.Card>, ]; return ( <HowToUse subtitle="How it works" headerContent="STEPS" message="Get started in minutes" linkHref="#sign-up" linkContent="Create free account" cardList={cardList} /> ); }
Compose HowToUse.Header, HowToUse.CardList, HowToUse.Card, and HowToUse.Footer directly and style each block with sx.
function Example() { return ( <HowToUse subtitle="How it works" headerContent="STEPS" message="Get started in minutes" linkHref="#sign-up" linkContent="Create free account" sx={{ maxWidth: 960, mx: 'auto', px: 2 }} > <HowToUse.Header sx={{ px: 2, py: 2, borderRadius: 2, bgcolor: 'grey.50', }} /> <HowToUse.CardList sx={{ '& .nbb-how-to-use-card': { border: '1px solid', borderColor: 'divider', bgcolor: 'background.paper', }, }} > <HowToUse.Card icon={EditOutlined} headerContent="Apply"> Create your account and tell us about your skills and experience. </HowToUse.Card> <HowToUse.Card icon={AccountBoxOutlined} headerContent="Set up your profile"> Add your work history, portfolio links, and preferences. </HowToUse.Card> <HowToUse.Card icon={AddToQueue} headerContent="Start matching"> Browse opportunities and apply to roles that fit your goals. </HowToUse.Card> </HowToUse.CardList> <HowToUse.Footer sx={{ '& .MuiButton-root': { borderRadius: 99, px: 5 }, }} /> </HowToUse> ); }
Use function children with defaultBlocks and defaultBlockOrder to inject blocks, replace defaults, and control order.
function Example() { const cardList = [ <HowToUse.Card key="apply" icon={EditOutlined} headerContent="Apply"> Create your account and tell us about your skills and experience. </HowToUse.Card>, <HowToUse.Card key="account" icon={AccountBoxOutlined} headerContent="Set up your profile"> Add your work history, portfolio links, and preferences. </HowToUse.Card>, <HowToUse.Card key="post" icon={AddToQueue} headerContent="Start matching"> Browse opportunities and apply to roles that fit your goals. </HowToUse.Card>, ]; return ( <HowToUse subtitle="How it works" headerContent="STEPS" message="Get started in minutes" linkHref="#sign-up" linkContent="Create free account" cardList={cardList} sx={{ maxWidth: 960, mx: 'auto', px: 2 }} > {({ defaultBlocks, defaultBlockOrder }) => ({ blocks: { ...defaultBlocks, promo: ( <Alert severity="info" sx={{ textAlign: 'center' }}> New teams get guided onboarding at no extra cost. </Alert> ), cardList: ( <HowToUse.CardList sx={{ p: 2, borderRadius: 2, bgcolor: 'background.paper', border: '1px solid', borderColor: 'divider', }} /> ), }, blockOrder: ['header', 'promo', 'cardList', 'footer'], })} </HowToUse> ); }
When to use block overrides
Default defaultBlockOrder is header, cardList, card, footer. The root render maps header, cardList, and footer in order (card is used for typing defaults but not rendered at the root). Prepend banners (for example promo) or replace cardList when you need a custom step layout while keeping cardList on the root component.
Important Props
Core Props
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
subtitle | ReactNode | Yes | — | Large headline in HowToUse.Header (h1, responsive up to 45px) |
headerContent | ReactNode | Yes | — | Supporting label in HowToUse.Header (primary.main, responsive h6/h4) |
message | ReactNode | Yes | — | Footer line above the CTA in HowToUse.Footer (hidden when falsy) |
linkHref | string | Yes | — | href on the footer contained button |
linkContent | ReactNode | Yes | — | Label on the footer button |
cardList | ReactNode[] | No | undefined | Step cards rendered by HowToUse.CardList when CardList has no children |
Layout and Composition Props
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
children | ReactNode | function | No | undefined | Compound sub-components (HowToUse.Header, HowToUse.CardList, HowToUse.Card, HowToUse.Footer) or a function ({ defaultBlocks, defaultBlockOrder }) => ({ blocks, blockOrder }) to inject or reorder layout blocks |
className | string | No | undefined | Class name on the root stack (nbb-how-to-use) |
sx | SxProps | No | undefined | MUI system styles for the root stack |
spacing | StackProps['spacing'] | No | { xs: 5, sm: 6 } | Vertical spacing on the root stack |
HowToUse inherits StackProps (except children). Default defaultBlockOrder: header, cardList, card, footer.
Sub-component props
Sub-components read from context and accept the same content keys as props to override locally.
| Sub-component | Main Props | Inherits | Built on |
|---|---|---|---|
HowToUse.Header | subtitle, headerContent, children, className, sx | StackProps | Stack + Typography |
HowToUse.CardList | cardList, children, className, sx | StackProps | Stack + ArrowRight / ArrowDropDown between cards |
HowToUse.Card | icon, headerContent, children, className, sx | CardProps | Card + Typography |
HowToUse.Footer | message, linkHref, linkContent, children, className, sx | StackProps | Stack + Button (variant="contained", size="large") |
Default UI Blocks
| Block | Built on | Notes |
|---|---|---|
HowToUse (root) | Stack | Column layout(nbb-how-to-use) |
header (HowToUse.Header) | Stack + Typography | Centered headerContent and subtitle headline |
cardList (HowToUse.CardList) | Stack + arrow icons | Column on xs, row on sm+; ArrowDropDown between cards on small screens, ArrowRight on larger screens |
card (HowToUse.Card) | Card + Typography | article card; icon, headerContent, and body text (nbb-how-to-use-card) |
footer (HowToUse.Footer) | Stack + Button | Optional message line and contained CTA with linkHref / linkContent;(nbb-how-to-use-footer) |
Default root render order: header → cardList → footer.
TypeScript
import * as React from 'react';
import type { SvgIconComponent } from '@mui/icons-material';
import { HowToUse } from '@nodeblocks/frontend-how-to-use-block';
import type { ReactNode } from 'react';
type HowToUseStep = {
key: string;
icon: SvgIconComponent;
headerContent: ReactNode;
body: ReactNode;
};
type HowToUseSectionProps = {
subtitle: ReactNode;
headerContent: ReactNode;
message: ReactNode;
linkHref: string;
linkContent: ReactNode;
steps: HowToUseStep[];
};
export function HowToUseSection({
subtitle,
headerContent,
message,
linkHref,
linkContent,
steps,
}: HowToUseSectionProps) {
const cardList = steps.map(({ key, icon, headerContent: title, body }) => (
<HowToUse.Card key={key} icon={icon} headerContent={title}>
{body}
</HowToUse.Card>
));
return (
<HowToUse
subtitle={subtitle}
headerContent={headerContent}
message={message}
linkHref={linkHref}
linkContent={linkContent}
cardList={cardList}
/>
);
}