8000 web/apps/ui-components at main Β· albinkc/web Β· GitHub
[go: up one dir, main page]

Skip to content

Latest commit

Β 

History

History
Β 
Β 

ui-components

README.md

React Flow components for shadcn/cli

This application is used for developing and publishing new components that can be installed by running the shadcn cli.

Adding components

npx shadcn init # initialize shadcn
npx shadcn add http://ui.reactflow.dev/<component-name>.json ## adding component

Developing new components

We have an initialization script that can be run via

pnpm add-component <component-name>

This adds the following files:

components/
β”œβ”€ xy/
β”‚  β”œβ”€ <component-name>/
β”‚  β”‚  β”œβ”€ index.tsx      # source code of the component
β”‚  β”‚  β”œβ”€ demo.tsx       # small demo showing usage to appear on website
β”‚  β”‚  β”œβ”€ registry.json  # shadcn configuration
app/
β”œβ”€ <component-name>/
β”‚  β”œβ”€ page.tsx          # route for rendering component

Deploying components

Inside the scripts/ folder you will find a script called generate-registry.js. This script is executed when running pnpm build. It generates registry files for the cli (regsitry/<component-name>.json), as well as a demo/<component-name>.json file with the example code for each component and saves them inside the public/ folder. This way by building and deploying the app we can directly host all neccessary files needed for the cli and integrating it with our website.

0