Demonstration | Deploy | Technologies
Pixel Patterns is a project aimed at developers that simplifies the integration of CSS and Tailwind components into their projects. The application allows you to copy ready-to-use components with just one click, making styling and building interfaces quick and efficient.
This open-source project not only offers an initial library of components but also allows the community to contribute their own components. With an intuitive interface and constantly expanding features, Pixel Patterns is ideal for those looking for a practical way to enhance front-end development.
Goals:
- Facilitate the use of CSS and Tailwind components with a one-click copy feature
- Allow the community to contribute their own components
- Continuous expansion with new features and components
- If you like the project, give it a star ⭐ and share to help out.
| Home Page | Buttons Page |
|---|---|
| Inputs Page | Loaders Page |
|---|---|
| Cards Page | Checkboxes Page |
|---|---|
| Forms Page |
|---|
Click the following link to view the deploy
Requires Node.js 20 or newer.
npm install
npm run dev| Script | Description |
|---|---|
npm run dev |
Start the development server |
npm run build |
Create a production build |
npm run start |
Serve the production build |
npm run lint |
Run ESLint |
npm run typecheck |
Run the TypeScript compiler without emitting files |
npm run format |
Format the codebase with Prettier |
npm run format:check |
Check formatting without writing changes |
JavaScript and TypeScript run directly in the browser, inside a sandboxed Web Worker (TypeScript is type-checked and compiled by the editor's bundled TypeScript service). No setup is needed.
The other languages (Python, Java, Go, Rust, C++, C#, Ruby and Swift) are executed by a Piston instance. The public Piston API is whitelist-only, so point the editor to your own instance:
# .env.local
NEXT_PUBLIC_PISTON_URL=http://localhost:2000/api/v2src/
├── app/ # Routes only: thin pages that compose features
│ ├── [collection]/page.tsx # Every snippet collection (generated from config)
│ ├── palettes/ # Color palette library
│ ├── resources/[slug]/ # Developer guides
│ └── code-editor/ gradient/ border-radius/ contribute/
├── components/ # Shared, domain-agnostic building blocks
│ ├── ui/ # Design-system primitives (button, switch, tooltip…)
│ ├── layout/ # Site chrome: navbar, footer, hero, navigation links
│ └── decorations/<name>/ # One folder per decoration: component, CSS Module, config
├── features/<domain>/ # Self-contained domains
│ ├── components/ # React components of the domain
│ ├── config/ # Static configuration and registries
│ ├── data/ # Content (snippets, palettes, guides)
│ ├── hooks/ lib/ store/ # Domain hooks, pure logic, Zustand stores
│ └── types.ts
├── config/ # Site metadata (no dependencies)
├── hooks/ # Generic React hooks
├── lib/ # Generic utilities (cn, color math, downloads)
└── styles/globals.css # Tailwind layers and design tokens
Features: snippets, code-highlight, code-editor, palettes, resources, gradient, border-radius and contribute.
Conventions:
- Dependencies point inwards, in four layers:
- Foundation —
lib,hooks,config,components/ui,components/decorations. Never imports features. - Features — domains built on the foundation. The only cross-feature dependency allowed is the shared
code-highlightfeature. - Shell —
components/layout, which composes feature configuration (e.g. the collection registry) into navigation. - Routes —
app, which wires everything together.
- Foundation —
- Files use
kebab-case, components usePascalCasenamed exports, hooks start withuse. - Import with the
@/alias (maps tosrc/); CSS Modules are imported relatively from the component next to them. - Add
"use client"only to files that use hooks, browser APIs or event handlers. Large content modules (likefeatures/snippets/data) are imported only by Server Components. - Global CSS is limited to Tailwind layers and design tokens in
src/styles/globals.css; component styles live in Tailwind classes or a colocated*.module.css.
- Open the collection file in
src/features/snippets/data/(for examplebuttons.tsx). - Append a new entry at the end of the array:
{
category: "css",
background: "bg-[#212121]",
iconColor: "#fff",
html: `
<button class="button-83501">Click me</button>
<style>
.button-83501 { /* ... */ }
</style>
`,
},Use category: "tailwind" with a content: (<button className="...">...</button>) JSX field for Tailwind components. Snippets must be static markup: what is rendered is exactly what gets copied, so event handlers are not supported. Add five random digits to every class and keyframe name in CSS snippets to avoid collisions with other components on the same page.
To add a new collection, register it in src/features/snippets/config/collections.ts and map its data in src/features/snippets/data/index.ts — the route, navigation entry and page metadata are generated from that registry.
New palettes go in src/features/palettes/data/palettes.ts and new guides in src/features/resources/data/guides/ (then list them in data/index.ts).
This project was developed with the following technologies:
✔ [NextJS]
✔ [ReactJS]
✔ [TypeScript]
✔ [CSS]
✔ [Tailwind CSS]
✔ [Shadcn UI]
Made by Luancss