Luancss/pixel-patterns
关于
现代化的开源组件代码片段:复制粘贴即可使用。
网站与应用开发实测星标增长
- 24小时
- 0
- 7天
- -1
- 15天
- -1
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文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.
📷 Demonstration
| Home Page | Buttons Page |
|---|---|
| Inputs Page | Loaders Page |
|---|---|
| Cards Page | Checkboxes Page |
|---|---|
| Forms Page |
|---|
💻 Deploy
Click the following link to view the deploy
🛠 Getting Started
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 |
Code Editor runtimes
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/v2
🗂 Project Structure
src/
├── 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.
➕ Adding a Component
- 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).
🚀 Technologies
This project was developed with the following technologies:
✔ [NextJS]
✔ [ReactJS]
✔ [TypeScript]
✔ [CSS]
✔ [Tailwind CSS]
✔ [Shadcn UI]
✍ Author
Made by Luancss
探索相关项目
加载中…