How To Use Block
The HowToUse Component is a fully customizable and accessible step-by-step guide component built with React and TypeScript. It provides a complete interface for displaying process flows, usage instructions, and call-to-action sections with modern design patterns and flexible customization options. Built on top of MUI components for consistent styling.
π Installationβ
npm install @nodeblocks/frontend-how-to-use-block@0.3.0
π Usageβ
import {HowToUse} from '@nodeblocks/frontend-how-to-use-block';
- Basic Usage
- Advanced Usage
function SimpleHowToUse() { return ( <HowToUse subtitle="How it works" headerContent="STEPS" message="Get started in just 1 minute!" linkHref="#sign-up" linkContent="Sign Up Free" > <HowToUse.Header subtitle="How it works"> <span>Getting Started Guide</span> </HowToUse.Header> <HowToUse.CardList> <HowToUse.Card icon={undefined} headerContent="Create Profile"> Sign up and create your professional profile with your skills and experience. </HowToUse.Card> <HowToUse.Card icon={undefined} headerContent="Browse Projects"> Search through available projects and find the ones that match your interests. </HowToUse.Card> <HowToUse.Card icon={undefined} headerContent="Get Connected"> Apply to projects and connect with potential employers. </HowToUse.Card> </HowToUse.CardList> <HowToUse.Footer message="Get started in just 1 minute!" linkHref="#sign-up" linkContent="Sign Up Free" /> </HowToUse> ); }
function AdvancedHowToUse() { const steps = [ { number: '01', title: 'Create Account', description: 'Sign up in seconds and set up your professional profile.', color: '#3b82f6', bgColor: '#eff6ff', }, { number: '02', title: 'Explore Options', description: 'Browse opportunities tailored to your skills and goals.', color: '#8b5cf6', bgColor: '#f5f3ff', }, { number: '03', title: 'Start Growing', description: 'Connect with employers and accelerate your career.', color: '#10b981', bgColor: '#ecfdf5', }, ]; return ( <HowToUse subtitle="Three simple steps to success" headerContent="HOW IT WORKS" message="Ready to transform your career?" linkHref="#get-started" linkContent="Get Started Free" sx={{ bgcolor: '#ffffff', py: 10, px: 4, }} > {({defaultBlocks, defaultBlockOrder}) => { const customCardList = ( <div style={{ display: 'flex', gap: '24px', justifyContent: 'center', flexWrap: 'wrap', padding: '0 16px', }} > {steps.map((step, index) => ( <div key={index} style={{ width: '320px', padding: '32px 28px', borderRadius: '20px', background: '#ffffff', border: `2px solid ${step.bgColor}`, position: 'relative', transition: 'all 0.3s ease', }} > <div style={{ width: '56px', height: '56px', borderRadius: '16px', background: step.bgColor, display: 'flex', alignItems: 'center', justifyContent: 'center', marginBottom: '20px', }} > <span style={{ fontSize: '20px', fontWeight: '800', color: step.color, fontFamily: 'monospace', }} > {step.number} </span> </div> <div style={{ fontSize: '20px', fontWeight: '700', color: '#1e293b', marginBottom: '12px', marginTop: 0, }} > {step.title} </div> <p style={{ fontSize: '15px', color: '#64748b', lineHeight: '1.6', margin: 0, }} > {step.description} </p> <div style={{ position: 'absolute', top: '24px', right: '24px', width: '8px', height: '8px', borderRadius: '50%', background: step.color, }} /> </div> ))} </div> ); return { blocks: { ...defaultBlocks, header: ( <HowToUse.Header subtitle="Three simple steps to success" sx={{ mb: 2, '& .MuiTypography-h4': { color: '#3b82f6', fontWeight: 700, letterSpacing: '0.15em', fontSize: '0.8rem', }, '& .MuiTypography-h1': { color: '#0f172a', fontWeight: 800, fontSize: {xs: '1.75rem', lg: '2.5rem'}, }, }} > <span>HOW IT WORKS</span> </HowToUse.Header> ), cardList: customCardList, footer: ( <HowToUse.Footer message="Ready to transform your career?" linkHref="#get-started" linkContent="Get Started Free" sx={{ mt: 4, '& .MuiTypography-body2': { color: '#64748b', fontWeight: 500, fontSize: '1rem', }, '& .MuiButton-root': { bgcolor: '#3b82f6', borderRadius: '12px', px: 5, py: 1.75, fontSize: '1rem', fontWeight: 600, textTransform: 'none', boxShadow: '0 4px 14px rgba(59, 130, 246, 0.35)', '&:hover': { bgcolor: '#2563eb', boxShadow: '0 6px 20px rgba(59, 130, 246, 0.45)', }, }, }} /> ), }, blockOrder: defaultBlockOrder, }; }} </HowToUse> ); }
π§ Props Referenceβ
Main Component Propsβ
| Prop | Type | Default | Description |
|---|---|---|---|
subtitle | ReactNode | Required | Subtitle text displayed in the header (larger text) |
headerContent | ReactNode | Required | Main header text content (smaller text above subtitle) |
message | ReactNode | Required | Message text displayed above the footer button |
linkHref | string | Required | URL for the call-to-action button |
linkContent | ReactNode | Required | Text content for the call-to-action button |
spacing | ResponsiveValue | { xs: 5, lg: 6 } | Spacing between child elements |
className | string | undefined | Additional CSS class name for styling the container |
sx | SxProps<Theme> | { backgroundColor: 'background.default', py: { xs: 5, lg: 10 }, px: { xs: 2, lg: 'unset' } } | MUI system props for custom styling |
children | BlocksOverride | undefined | Custom blocks override for advanced customization |
Note: This component inherits all MUI Stack component props. All context values (subtitle, headerContent, message, linkHref, linkContent) are passed down to sub-components.
Sub-Componentsβ
The HowToUse component provides several sub-components. All sub-components receive their default values from the main component's context and can override these values through props.
HowToUse.Headerβ
Renders the header section using MUI Stack with two Typography elements.
| Prop | Type | Default | Description |
|---|---|---|---|
subtitle | ReactNode | Context value | Subtitle text (larger, displayed below header) |
children | ReactNode | Context headerContent | Main header text (smaller, displayed above subtitle) |
spacing | ResponsiveValue | { xs: 0.5, lg: 1 } | Spacing between header and subtitle |
className | string | undefined | Additional CSS class name for styling |
sx | SxProps<Theme> | { textAlign: 'center' } | MUI system props for custom styling |
Note: This component inherits all MUI Stack component props. The header text uses h4 variant with primary.main color, and subtitle uses h1 variant.
HowToUse.CardListβ
Renders a responsive list of cards with arrow indicators between them.
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | Required | Array of Card components to display |
direction | ResponsiveValue | { xs: 'column', lg: 'row' } | Stack direction |
className | string | undefined | Additional CSS class name for styling |
sx | SxProps<Theme> | { alignItems: { xs: 'center', lg: 'stretch' }, justifyContent: 'center' } | MUI system props for custom styling |
Note: This component inherits all MUI Stack component props. Automatically adds ArrowRight icons between cards on desktop and ArrowDropDown icons on mobile.
HowToUse.Cardβ
Renders an individual step card using MUI Card.
| Prop | Type | Default | Description |
|---|---|---|---|
icon | SvgIconComponent | Required | Icon component that accepts props (MUI icons from @mui/icons-material or custom SVG components) |
headerContent | ReactNode | Context value | Title text for the card |
children | ReactNode | Required | Description content of the card |
className | string | undefined | Additional CSS class name for styling |
sx | SxProps<Theme> | { width: '100%', maxWidth: 360 } | MUI system props for custom styling |
Note: This component inherits all MUI Card component props. Rendered with component="article" and elevation={0}. The icon should be a component (not an element) - either from @mui/icons-material or a custom SVG component that accepts props.
HowToUse.Footerβ
Renders the footer section with message and call-to-action button.
| Prop | Type | Default | Description |
|---|---|---|---|
message | ReactNode | Context value | Message text displayed above the button |
linkHref | string | Context value | URL for the button |
linkContent | ReactNode | Context value | Button text content |
children | ReactNode | undefined | Additional content |
spacing | number | 1.5 | Spacing between message and button |
className | string | undefined | Additional CSS class name for styling |
sx | SxProps<Theme> | { alignItems: 'center' } | MUI system props for custom styling |
Note: This component inherits all MUI Stack component props. Uses MUI Button with variant="contained" and size="large".
π¨ Configuration examplesβ
Custom Header Stylingβ
<HowToUse.Header
subtitle="Getting Started"
sx={{
textAlign: 'left',
'& .MuiTypography-h4': {
color: 'secondary.main',
fontSize: 16,
},
'& .MuiTypography-h1': {
fontSize: 32,
fontWeight: 700,
},
}}
>
<span>HOW IT WORKS</span>
</HowToUse.Header>
Custom Card Stylingβ
<HowToUse.Card
icon={undefined}
headerContent="Register"
sx={{
maxWidth: 400,
bgcolor: 'grey.50',
borderRadius: 3,
border: '1px solid',
borderColor: 'grey.200',
}}
>
Create your account
</HowToUse.Card>
Custom Footer Button Stylingβ
<HowToUse.Footer
message="Ready to begin?"
linkHref="#signup"
linkContent="Get Started"
sx={{
'& .MuiButton-root': {
bgcolor: 'success.main',
borderRadius: 8,
px: 6,
py: 2,
'&:hover': {
bgcolor: 'success.dark',
},
},
}}
/>
π§ TypeScript Supportβ
Full TypeScript support with comprehensive type definitions:
import {HowToUse} from '@nodeblocks/frontend-how-to-use-block';
import {StackProps, CardProps} from '@mui/material';
import {SvgIconComponent} from '@mui/icons-material';
import {ReactNode} from 'react';
// Main component props extend MUI StackProps
interface HowToUseProps extends Omit<StackProps, 'children'> {
subtitle: ReactNode;
headerContent: ReactNode;
message: ReactNode;
linkHref: string;
linkContent: ReactNode;
children?: BlocksOverride;
}
// Context type (values passed to all sub-components)
interface HowToUseContextValue {
subtitle: ReactNode;
headerContent: ReactNode;
message: ReactNode;
linkHref: string;
linkContent: ReactNode;
}
// Card props - note icon is SvgIconComponent
interface CardProps extends MuiCardProps {
icon: SvgIconComponent;
headerContent: ReactNode;
children: ReactNode;
}
// Example with typed props
function CustomStyledHowToUse() {
return (
<HowToUse
subtitle="Getting Started"
headerContent="HOW IT WORKS"
message="Ready to begin?"
linkHref="#signup"
linkContent="Get Started"
sx={{py: 8}}
>
<HowToUse.Header
subtitle="Getting Started"
sx={{
textAlign: 'left',
'& .MuiTypography-h4': {
color: 'secondary.main',
fontSize: 16,
},
'& .MuiTypography-h1': {
fontSize: 32,
fontWeight: 700,
},
}}
>
<span>HOW IT WORKS</span>
</HowToUse.Header>
<HowToUse.CardList>
<HowToUse.Card
icon={undefined}
headerContent="Register"
sx={{
maxWidth: 400,
bgcolor: 'grey.50',
borderRadius: 3,
border: '1px solid',
borderColor: 'grey.200',
}}
>
Create your account
</HowToUse.Card>
<HowToUse.Card
icon={undefined}
headerContent="Explore"
sx={{
maxWidth: 400,
bgcolor: 'grey.50',
borderRadius: 3,
border: '1px solid',
borderColor: 'grey.200',
}}
>
Find opportunities
</HowToUse.Card>
<HowToUse.Card
icon={undefined}
headerContent="Connect"
sx={{
maxWidth: 400,
bgcolor: 'grey.50',
borderRadius: 3,
border: '1px solid',
borderColor: 'grey.200',
}}
>
Build relationships
</HowToUse.Card>
</HowToUse.CardList>
<HowToUse.Footer
message="Ready to begin?"
linkHref="#signup"
linkContent="Get Started"
sx={{
'& .MuiButton-root': {
bgcolor: 'success.main',
borderRadius: 8,
px: 6,
py: 2,
'&:hover': {
bgcolor: 'success.dark',
},
},
}}
/>
</HowToUse>
);
}
π Notesβ
- The component uses MUI's
Stackas the root container with responsive padding - Default background color is
theme.palette.background.default - HowToUse.Header displays two Typography elements: header text (h4) and subtitle (h1)
- HowToUse.CardList automatically adds arrow icons between cards (ArrowRight on desktop, ArrowDropDown on mobile)
- HowToUse.Card uses MUI Card with
elevation={0}andcomponent="article" - HowToUse.Card icon must be an MUI
SvgIconComponent, not a ReactNode element - HowToUse.Footer uses MUI Button with
variant="contained"andsize="large" - All sub-components support the
sxprop for MUI system styling - Block override pattern allows inserting custom blocks and reordering
Built with β€οΈ using React, TypeScript, and MUI.