This guide explains how to use Signoz components library powered by Turborepo, React, and Storybook.
Clone the repository:
git clone git@github.com:SigNoz/components.git
Install dependencies:
pnpm install
Build the packages:
pnpm build
Start Storybook:
pnpm run dev
pnpm build
- Build all packages, including the Storybook sitepnpm dev
- Run all packages locally and preview with Storybookpnpm lint
- Lint all packagespnpm changeset
- Generate a changesetpnpm clean
- Clean up all node_modules
and dist
folderspnpm turbo gen new-package
- Custom generator script to add new component/package to the component library@signozhq/theme
: Contains theme provider, theme switcher, ...@signozhq/tailwind-config
: UI configuration, including Tailwind CSS setup@signozhq/button
: Button component@signozhq/input
: Input componentTo create a new package:
Create a new branch:
git checkout -b feature/new-package-name
From the root of the project, run:
pnpm turbo gen new-package
During the package creation process, you'll be asked to input a name, description, and choose between creating a component from scratch or importing one from shadcn. Provide the requested information as prompted. Here's an example:
e.g.
❯ pnpm turbo gen new-package
turbo 2.1.2
>>> Modify "design-system" using custom generators
? What is the name of the new package? dropdown-menu
? Provide a brief description of the package: dropdown menu package
? Do you want to import a shadcn component or create a component from scratch? (Use arrow keys)
❯ shadcn
from_scratch
Executing this generator will automatically set up and configure the new package with the necessary files and structure.
├── apps
│ └── docs
│ ├── package.json (modified)
│ └── stories
│ └── dropdown-menu.stories.tsx (new)
├── packages
│ └── dropdown-menu
│ ├── .eslintrc.js (new)
│ ├── components.json (new)
│ ├── package.json (new)
│ ├── postcss.config.js (new)
│ ├── src
│ │ ├── dropdown-menu.tsx (new)
│ │ ├── index.css (new)
│ │ └── lib
│ │ └── utils.ts (new)
│ ├── tailwind.config.js (new)
│ ├── tsconfig.app.json (new)
│ ├── tsconfig.json (new)
│ └── vite.config.ts (new)
Make the necessary changes:
packages/dropdown-menu/src/dropdown-menu.tsx
)apps/docs/stories/dropdown-menu.stories.tsx
From the root of the project, commit the changes to the new branch:
git add .
git commit -m "Add new package: dropdown-menu"
From the root of the project, run:
pnpm changeset
This will guide you through the process of creating a changeset, which is used to document changes and manage version bumps.
Push the changes to the remote repository:
git push origin feature/new-package-name
Create a new PR