Follow these steps to add a new component to the project. Each step includes details and file paths to avoid confusion.
Tip: Replace [component-name] with your actual component name (e.g., fancy-button).
- Add your component to navigation:
Editsrc/data/navigation.ts.
Add an entry for your component with its name, href, andlastModifieddate.
Example:{ name: "Fancy Button", href: "/docs/fancy-button", lastModified: "2025-10-31T12:00:00+05:30" }
- Add the
lastModifieddate. This is important for SEO. To get the date, you can use the following command in your terminal:node new Date().toISOString()
- Create the component file:
Insrc/components/content, create a new file named[component-name].tsx.
Example:src/components/content/fancy-button.tsx
- Create docs folder:
Insrc/apps/docs, create a folder named[component-name].
Example:src/apps/docs/fancy-button/
- Add a demo file:
Inside your docs folder, create[component-name]-demo.tsx(or another example file).
Example:src/apps/docs/fancy-button/fancy-button-demo.tsx
- Create documentation page:
In your docs folder, addpage.mdx.
Example:src/apps/docs/fancy-button/page.mdx
- Complete the MDX page:
Use the template atsrc/template/page.mdxto fill in metadata and documentation based on your component.
- Update registry:
Editscripts/registery-components.ts.
Add your component to thecomponentsarray with all required details.
- Update examples registry:
Editscripts/registery-examples.ts.
Add your component and its example(s) to theexamplesobject, following the same format as the other examples.
- Create component JSON:
Run:This createspnpm run register -- --name=[component-name] --author=["Your Name"][component-name].jsoninpublic/c, author is optional if you have added it in the component meta data file, replace[component-name]with your component name (e.g.,button).
- Check your JSON file:
Compare your new JSON file inpublic/cwith others to ensure consistency.
- Create example JSON:
Run:This createspnpm run register:v0 -- --name=[component-name][component-name]-demo.jsoninpublic/e, replace[component-name]with your component name.
- Review all changes:
Double-check each step and file for accuracy. - Uncheck the checklist and commit:
Mark completed items, then commit your changes.
If you have questions, ask in the discussions (issues) or check existing components for reference.