ui icon indicating copy to clipboard operation
ui copied to clipboard

Proposal for React-Component-Marketplace (addons)

Open rajatsandeepsen opened this issue 1 year ago • 7 comments
trafficstars

React-Component-Marketplace (addons)

Screenshot 2023-12-26 015116

When @shadcn/ui becomes popular, users like the idea of distributing components straight to the code base.

So my proposal is to expand and allow other creators to publish their ui components (addons which uses shadcn, tailwind & radix as primitives). I modified the CLI, so users can add these "addons" straight to their codebase.

It's like NPM, but for react components. Creator will login and publish their creativity as addons. These addons stays in @/components/addons/example-component-name/index.tsx.

And shadcn-ui@latest CLI can identify shadcn and non-shadcn components. No need to specify addons path in component.config.json

Overall folder structure.

root
 ├─┬ app
 │ ├── layout.tsx
 │ └── page.tsx
 ├─┬ components
 │ ├─┬ ui
 │ │ ├── alert-dialog.tsx
 │ │ ├── button.tsx
 │ │ ├── dropdown-menu.tsx
 │ │ └── ...
 │ └─┬ addons
 │   └─┬ example-component-name
 │     ├── index.tsx
 │     └── README.md
 ├─┬ lib
 │ └── utils.ts
 ├─┬ styles
 │ └── globals.css
 ├── component.config.json
 ├── package.json
 ├── postcss.config.js
 ├── tailwind.config.js
 └── tsconfig.json

Purpose

Purpose was to enable distribution of customizable react components straight to your codebase instead of npm install.

Perspective of Creators

Creators build bigger components with shadcn and publish straight to shadcn-marketplace. Creator requires to have gtihub account and unique name for addons.

Screenshot 2023-12-26 015211 Screenshot 2023-12-26 015448

  1. Goto /marketplace
  2. Login with Github
  3. Goto /marketplace/create
  4. Name the addon, Drop the parent folder of addon (📁 example-component-name).
  5. Add required NPM dependencies and Registry dependencies (shadcn ui components).
  6. Publish
  └─┬ addons
    └─┬ example-component-name 📁 
      ├── other-important-folders
      ├── index.tsx
      └── README.md

NB: one of the README.md file is used for the documentation of addon. Therefor README.md is required as root folder file.

Perspective of Users

User doesn't need to login, all addons are free and open. Any additional shadcn register dependencies will be installed on single run.

  1. Goto web side /marketplace
  2. find addon name.
  3. Run npx shadcn-ui@latest add [addons]

eg: pnpm dlx shadcn-ui@latest add skeleton example Screenshot 2023-12-24 023346

Technical perspective

Component registry work as normal. But marketplace required to have Database, next-auth configs. README.md file is rendered on server side with next-mdx-remote). So it has some technical issues like

  • code block doesn't have syntax highlighting
  • creators can't show the true working of component in docs. (instead basic visualization is possible)
  • requires more time to fetch the page.
  • CLI need little more time to identify shadcn and non-shadcn components.

Demo

CLI

  1. npx shadcn-marketplace@beta
  2. npx shadcn-marketplace@beta add example skeleton

Web

/marketplace

rajatsandeepsen avatar Dec 25 '23 21:12 rajatsandeepsen

@rajatsandeepsen is attempting to deploy a commit to the shadcn-pro Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Dec 25 '23 21:12 vercel[bot]

I know its a big PR. But idea is still in construction. Requires more feedback and iteration before merge. @shadcn If idea is approved, I'll continue working in this.

TODO

  • [ ] Syntax highlighting in codeblocks
  • [ ] feature to upload image as preview of addons
  • [ ] feature to publish addons straight from CLI
  • [ ] UX in /create page
  • [ ] features to share, star and search addons on web

rajatsandeepsen avatar Dec 25 '23 21:12 rajatsandeepsen

Love this idea

karam-khanna avatar Dec 26 '23 01:12 karam-khanna

so interesting

AhmedBaset avatar Dec 26 '23 06:12 AhmedBaset

Love the idea, I know of two people who might be interested to bring their components over to this proposed marketplace:

@JaleelB's https://github.com/JaleelB/shadcn-tag-input

@uncvrd's https://github.com/uncvrd/shadcn-ui-date-time-picker

aryanprince avatar Dec 26 '23 09:12 aryanprince

@rajatsandeepsen Thanks for the PR. I know this is a popular ask. Looking into it.

shadcn avatar Jan 07 '24 09:01 shadcn

I love this idea. I was just about to start my own website for this @rajatsandeepsen. It would also be nice to include some way to add themes (like how you can 'customise' this). Not sure if this is possible.

Screenshot 2024-01-30 at 17 49 25

tika avatar Jan 30 '24 17:01 tika

This is a much welcome feature. Be aware: developers in the Next.js community might get extremely violent when they are asked about such a marketplace. But I'm sure actual product builders will enjoy this a lot.

https://www.reddit.com/r/nextjs/comments/1cz1e2a/there_is_no_marketplace_for_react_components/

crawlchange avatar May 23 '24 23:05 crawlchange

Any update on this? I'm waiting coz I have a customized a bunch of shadcn components for my own "theme". I want to be able to do the same cli command across my projects instead of copy pasting, will be also good to keep them all updated at once. I have also made other components in shadcn format like drag and drop so it would be nice to be able to share these!

ezraanglo avatar Jun 13 '24 14:06 ezraanglo