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.
π Installationβ
npm install @nodeblocks/frontend-how-to-use-block
π Usageβ
import {HowToUse} from '@nodeblocks/frontend-how-to-use-block';
- Basic Usage
- Advanced Usage
function BasicHowToUse() { return ( <HowToUse> <HowToUse.Header subtitle="How it works"> STEPS </HowToUse.Header> <HowToUse.CardList> <HowToUse.Card icon={<span>π</span>} headerContent="Create Profile"> Sign up and create your professional profile with your skills and experience. </HowToUse.Card> <HowToUse.Card icon={<span>π</span>} headerContent="Browse Projects"> Search through available projects and find the ones that match your interests. </HowToUse.Card> <HowToUse.Card icon={<span>π¬</span>} 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() { return ( <HowToUse> {({ defaultBlocks, defaultBlockOrder }) => ({ blocks: { ...defaultBlocks, // π Custom Header with props override header: { ...defaultBlocks.header, props: { ...defaultBlocks.header.props, subtitle: "π Your Journey to Success", className: "custom-header", style: { textAlign: 'center', padding: '30px', backgroundColor: '#f8f9fa', borderRadius: '12px', marginBottom: '40px' }, children: "β¨ HOW IT WORKS" }, }, // π Rich Card List with full component override cardList: ( <div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(300px, 1fr))', gap: '30px', padding: '20px 0' }}> <div style={{ backgroundColor: '#fff', padding: '30px', borderRadius: '16px', boxShadow: '0 4px 20px rgba(0,0,0,0.1)', textAlign: 'center', border: '2px solid #e3f2fd', transition: 'transform 0.3s ease' }}> <div style={{ fontSize: '3rem', marginBottom: '20px', background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)', WebkitBackgroundClip: 'text', WebkitTextFillColor: 'transparent' }}> π― </div> <h3 style={{ color: '#1976d2', marginBottom: '15px', fontSize: '1.5rem' }}> Set Your Goals </h3> <p style={{ color: '#666', lineHeight: '1.6' }}> Define your career objectives targets to create a personalized roadmap for success. </p> </div> <div style={{ backgroundColor: '#fff', padding: '30px', borderRadius: '16px', boxShadow: '0 4px 20px rgba(0,0,0,0.1)', textAlign: 'center', border: '2px solid #e8f5e8', transition: 'transform 0.3s ease' }}> <div style={{ fontSize: '3rem', marginBottom: '20px', background: 'linear-gradient(135deg, #4caf50 0%, #45a049 100%)', WebkitBackgroundClip: 'text', WebkitTextFillColor: 'transparent' }}> π </div> <h3 style={{ color: '#388e3c', marginBottom: '15px', fontSize: '1.5rem' }}> Build Your Profile </h3> <p style={{ color: '#666', lineHeight: '1.6' }}> Create a compelling profile that showcases your skills, experience, and achievements </p> </div> <div style={{ backgroundColor: '#fff', padding: '30px', borderRadius: '16px', boxShadow: '0 4px 20px rgba(0,0,0,0.1)', textAlign: 'center', border: '2px solid #fff3e0', transition: 'transform 0.3s ease' }}> <div style={{ fontSize: '3rem', marginBottom: '20px', background: 'linear-gradient(135deg, #ff9800 0%, #f57c00 100%)', WebkitBackgroundClip: 'text', WebkitTextFillColor: 'transparent' }}> π </div> <h3 style={{ color: '#f57c00', marginBottom: '15px', fontSize: '1.5rem' }}> Launch Your Journey </h3> <p style={{ color: '#666', lineHeight: '1.6' }}> Start applying to opportunities, connect with professionals </p> </div> </div> ), // π Custom Footer with props override footer: { ...defaultBlocks.footer, props: { ...defaultBlocks.footer.props, message: "Ready to transform your career? π―", linkHref: "#get-started", linkContent: "π Start Your Journey Now", className: "custom-footer", style: { background: 'white', color: 'white', padding: '40px', borderRadius: '16px', textAlign: 'center', marginTop: '40px' } }, }, }, blockOrder: defaultBlockOrder, })} </HowToUse> ); }
π§ Props Referenceβ
Main Component Propsβ
Prop | Type | Default | Description |
---|---|---|---|
className | string | undefined | Additional CSS class name for styling the container |
children | BlocksOverride | undefined | Custom blocks override for advanced customization |
Note: The main component inherits all HTML div
element props.
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β
Prop | Type | Default | Description |
---|---|---|---|
children | ReactNode | "STEP" | Main header text content |
subtitle | ReactNode | "How it works" | Subtitle text displayed below the main header |
Note: This component inherits all HTML div
element props.
HowToUse.CardListβ
Prop | Type | Default | Description |
---|---|---|---|
children | ReactNode | Default cards array | Array of Card components to display in sequence |
Note: This component inherits all HTML div
element props.
HowToUse.Cardβ
Prop | Type | Default | Description |
---|---|---|---|
icon | ReactNode | Required | Icon or element to display in the card header |
headerContent | ReactNode | Required | Title content for the card |
children | ReactNode | Required | Description or body content of the card |
Note: This component inherits all HTML div
element props.
HowToUse.Footerβ
Prop | Type | Default | Description |
---|---|---|---|
message | ReactNode | "Get started in just 1 minute!" | Message text displayed above the call-to-action button |
linkHref | string | "/sign-up" | URL for the call-to-action button |
linkContent | ReactNode | "Sign Up Free" | Text content for the call-to-action button |
children | ReactNode | undefined | Additional content to display in the footer |
Note: This component inherits all HTML div
element props.
π§ TypeScript Supportβ
Full TypeScript support with comprehensive type definitions:
import {HowToUse} from '@nodeblocks/frontend-how-to-use-block';
import {ComponentProps, ReactNode} from 'react';
// Main component interface
interface HowToUseProps extends Omit<ComponentProps<'div'>, 'children'> {
children?: BlocksOverride<DefaultBlocks, CustomBlocks>;
}
// Sub-component interfaces (all inherit from their respective HTML elements)
interface HeaderProps extends ComponentProps<'div'> {
subtitle: ReactNode;
}
interface CardProps extends ComponentProps<'div'> {
icon: ReactNode;
headerContent: ReactNode;
}
interface FooterProps extends ComponentProps<'div'> {
message: ReactNode;
linkHref: string;
linkContent: ReactNode;
}
// Example with custom step interface
interface CustomStep {
icon: React.ReactNode;
title: string;
description: string;
}
const steps: CustomStep[] = [
{
icon: <span>π</span>,
title: 'Register',
description: 'Create your account and profile',
},
{
icon: <span>π</span>,
title: 'Search',
description: 'Find projects that match your skills',
},
{
icon: <span>πΌ</span>,
title: 'Apply',
description: 'Submit applications to interesting projects',
},
];
// Advanced example with custom styling and props
function CustomHowToUse() {
return (
<HowToUse className="custom-how-to-use" id="getting-started-section" style={{padding: '2rem'}}>
<HowToUse.Header subtitle="Getting Started" className="custom-header" style={{textAlign: 'center'}}>
HOW IT WORKS
</HowToUse.Header>
<HowToUse.CardList className="custom-card-list" style={{maxWidth: '1200px', margin: '0 auto'}}>
{steps.map((step, index) => (
<HowToUse.Card
key={index}
icon={step.icon}
headerContent={step.title}
className="custom-step-card"
style={{backgroundColor: '#f8f9fa'}}
>
{step.description}
</HowToUse.Card>
))}
</HowToUse.CardList>
<HowToUse.Footer
message="Start your journey today!"
linkHref="/get-started"
linkContent="Get Started Now"
className="custom-footer"
style={{marginTop: '3rem'}}
/>
</HowToUse>
);
}
Built with β€οΈ using React, TypeScript, and modern web standards.