A modern React component library built with TypeScript, Vite, and Storybook. This library provides a collection of reusable UI components for building web applications.
Explore all components interactively with live examples, props documentation, and usage guidelines.
- π Built with React 18 and TypeScript
- π¦ Vite for fast development and optimized builds
- π Storybook 8 for component documentation and testing
- π SCSS Modules for scoped styling
- π¨ Responsive and accessible components
- π± Mobile-first design approach
- π§ Fully typed with TypeScript
- Banner - Full-width image banner with centered text overlay
- Hero - Responsive hero image with picture element support
- Tile - Square tiles that display images or text content with multiple color variants
- NavBar - Responsive navigation bar with logo and links
- InfoPanel - Panel with image background, heading, description and CTA link
- Pagination - Navigation controls for paginated content
- SectionNav - Horizontal navigation for filtering/categorizing content
- Card - Reusable card for blog posts, products, or general content
- Grid - Responsive grid layout for displaying collections
- BrowserUpgrade - Warning message for outdated browsers
The library includes example layouts in Storybook showing how to compose components:
- HomePage - Landing page with hero, tiles, and info panel
- BlogPage - Blog listing with grid, cards, and pagination
- ShopPage - E-commerce page with product grids and categories
npm install @j-cam/pattern-libraryOr with yarn:
yarn add @j-cam/pattern-libraryimport { Banner, Hero, Tile, NavBar } from '@j-cam/pattern-library';
import '@j-cam/pattern-library/styles';<Banner
imageSrc="https://example.com/banner.jpg"
imageAlt="Beautiful landscape"
heading="Welcome to Our Site"
/><Hero
imageSrcMobile="https://example.com/hero-mobile.jpg"
imageSrcDesktop="https://example.com/hero-desktop.jpg"
imageAlt="Hero background"
heading="Hero Module"
/><Tile
content={{
type: 'text',
number: '#1',
title: 'Tile Title',
info: 'Tile description text goes here.'
}}
variant="grey"
/><NavBar
logoAlt="Company Name"
links={[
{ label: 'Home', href: '/' },
{ label: 'About', href: '/about' },
{ label: 'Contact', href: '/contact' }
]}
/>- Node.js 18+
- npm or yarn
- Clone the repository:
git clone https://github.com/j-cam/pattern-library.git
cd pattern-library- Install dependencies:
npm install- Start Storybook for development:
npm run devThis will start Storybook at http://localhost:6006
npm run dev- Start Storybook development servernpm run build- Build the library for productionnpm run build-storybook- Build Storybook for deploymentnpm run lint- Lint the codebasenpm run type-check- Run TypeScript type checking
To build the library for production:
npm run buildThis will create optimized files in the dist directory:
dist/index.js- ES module builddist/index.cjs- CommonJS builddist/index.d.ts- TypeScript definitionsdist/style.css- Bundled styles
pattern-library/
βββ .storybook/ # Storybook configuration
βββ src/
β βββ components/ # React components
β β βββ Banner/
β β βββ Hero/
β β βββ Tile/
β β βββ NavBar/
β βββ styles/ # Global styles and variables
β β βββ _variables.scss
β β βββ global.scss
β βββ index.ts # Main export file
βββ package.json
βββ tsconfig.json # TypeScript configuration
βββ vite.config.ts # Vite configuration
βββ README.md
All components are fully typed with TypeScript. Import types alongside components:
import { Banner, type BannerProps } from '@j-cam/pattern-library';
const MyBanner: React.FC<BannerProps> = (props) => {
return <Banner {...props} />;
};Components use SCSS modules for styling. Global styles and design tokens are available in src/styles/.
To customize styles, you can override CSS custom properties:
:root {
--color-primary: #your-color;
--font-sans: 'Your Font', sans-serif;
}- Chrome (latest)
- Firefox (latest)
- Safari (latest)
- Edge (latest)
Contributions are welcome! Please feel free to submit a Pull Request.
GPL-2.0
Jamie Campbell