shadcn-ui / ui

Beautifully designed components that you can copy and paste into your apps. Accessible. Customizable. Open Source.
https://ui.shadcn.com
MIT License
70.52k stars 4.23k forks source link

[feat]: Docs on Custom themes / components for CLI #4793

Open dylandignan opened 2 weeks ago

dylandignan commented 2 weeks ago

Feature description

As mentioned in https://x.com/shadcn/status/1831771732690215413, you can have your own registry to distribute custom themes or components.

I have looked at the code and can reverse engineer how we might be able to do this ourselves, but it's not clear exactly what all is required for setup. I see that it's all JSON files in the registry which turn into code, but some things like https://ui.shadcn.com/r/styles/default/toast.json have import type {\n ToastActionElement,\n ToastProps,\n} from \"@/registry/default/ui/toast\" which that registry/default seems to be substituted at runtime.

Additionally, it's not clear what the side effects are of each ItemType (https://github.com/shadcn-ui/ui/blob/078dfe66072c4ca780bbc99d4ad4b13b1f44fe7e/apps/www/registry/schema.ts#L16-L26).

It would be nice to have a more curated set of documentation which explained how folks can use this to write their own registries and use the shadcn cli to distribute their own code. Simple examples like https://raw.githubusercontent.com/mindtown-ai/dynamic-prompt/main/schema.json make sense, but not when intra-registry components start to come in to play.

Affected component/components

No response

Additional Context

Additional details here...

Before submitting

lklyne commented 4 days ago

This would be helpful! I've been looking for an approach to adjust the spacing within a theme. The demo video shows this but can't find any documentation on how it's accomplished.