1
1
---
2
2
title : CLI
3
- description : Use the CLI to add components to your project.
3
+ description : Use the CLI to add Plate UI components to your project.
4
4
---
5
5
6
- <Callout className = " mt-6" >
7
- WIP – We're migrating to <Link href = " https://ui.shadcn.com/docs/cli" >npx shadcn</Link >.
8
- </Callout >
9
-
10
- { /* <Callout>
11
-
12
- **Note:** We are now using the `shadcn` CLI.
13
-
14
- </Callout>
15
-
16
6
## init
17
7
18
- Use the `init` command to initialize configuration and dependencies for a new project.
8
+ Use the ` init ` command to initialize configuration and dependencies for a new project with Plate UI .
19
9
20
10
The ` init ` command installs dependencies, adds the ` cn ` util, configures ` tailwind.config.js ` , and CSS variables for the project.
21
11
22
12
``` bash
23
- npx @udecode/plate-ui@latest init
13
+ npx shadcx@latest init -u https://platejs.org/r -n plate-ui
14
+ ```
15
+
16
+ If you also want to use <Link href = " https://ui.shadcn.com/" >shadcn/ui</Link > in your project, you can use the following command:
17
+
18
+ ``` bash
19
+ npx shadcx@latest init
20
+ npx shadcx@latest init -u https://platejs.org/r -n plate-ui
24
21
```
25
22
26
23
You will be asked a few questions to configure ` components.json ` :
27
24
28
25
``` txt showLineNumbers
29
- Which style would you like to use? › Default
30
26
Which color would you like to use as base color? › Slate
31
27
Do you want to use CSS variables for colors? › yes
32
28
```
33
29
34
- To have the same look than Plate UI, you should:
35
-
36
- - Pick "Default" for the style. Plate does not have the "New York" style.
37
- - Pick "Slate" for the base color.
38
- - Pick "Yes" for using CSS variables.
39
-
40
- You should get something like this:
41
-
42
- ```txt
43
- npx shadcn@latest init
44
- Need to install the following packages:
45
-
46
- Ok to proceed? (y) y
47
-
48
- ✔ Preflight checks.
49
- ✔ Verifying framework. Found Next.js.
50
- ✔ Validating Tailwind CSS.
51
- ✔ Validating import alias.
52
- ✔ Which style would you like to use? › Default
53
- ✔ Which color would you like to use as the base color? › Slate
54
- ✔ Would you like to use CSS variables for theming? … no / yes
55
- ✔ Writing components.json.
56
- ✔ Checking registry.
57
- ✔ Updating tailwind.config.js
58
- ✔ Updating src/styles/globals.css
59
- ✔ Installing dependencies.
60
- ✔ Created 1 file:
61
- - src/lib/utils.ts
62
-
63
- Success! Project initialization completed.
64
- You may now add components.
65
- ```
66
-
67
30
### Options
68
31
69
32
``` txt
70
- Usage: shadcn init [options] [components... ]
33
+ Usage: shadcx init [options]
71
34
72
35
initialize your project and install dependencies
73
36
74
- Arguments:
75
- components the components to add or a url to the component.
76
-
77
37
Options:
78
- -d, --defaults use default values i.e new-york, zinc and css variables. (default: false)
38
+ -d, --defaults use default values i.e slate and css variables. (default: false)
79
39
-f, --force force overwrite of existing components.json. (default: false)
80
40
-y, --yes skip confirmation prompt. (default: false)
81
41
-c, --cwd <cwd> the working directory. defaults to the current directory.
82
- -h, --help display help for command
42
+ -u, --url <url> custom registry URL. (default: https://platejs.org/r)
43
+ -n, --name <name> registry name. (default: plate-ui)
44
+ -h, --help display help for command
83
45
```
84
46
85
47
## add
86
48
87
- Use the `add` command to add components and dependencies to your project.
49
+ Use the ` add ` command to add Plate UI components and dependencies to your project.
88
50
89
51
``` bash
90
- npx @udecode/plate-ui @latest add [component]
52
+ npx shadcx @latest add [component]
91
53
```
92
54
93
55
You will be presented with a list of components to choose from:
@@ -107,73 +69,63 @@ Enter to submit.
107
69
◯ combobox
108
70
```
109
71
110
- <Callout className="my-4">
111
- Pick the components you want in our <Link href="/?builder=true" target="_blank">interactive builder</Link> to generate the bulk add command to run.
112
- </Callout>
113
-
114
72
### Options
115
73
116
74
``` txt
117
- Usage: @udecode/plate-ui add [options] [components...]
75
+ Usage: shadcx add [options] [components...]
118
76
119
77
add a component to your project
120
78
121
79
Arguments:
122
- components the components to add
80
+ components the components to add.
123
81
124
82
Options:
125
- -y, --yes skip confirmation prompt. (default: false)
126
- -o, --overwrite overwrite existing files. (default: false)
127
- -c, --cwd <cwd> the working directory. defaults to the current directory.
128
- -p, --path <path> the path to add the component to.
129
- -h, --help display help for command
83
+ -y, --yes skip confirmation prompt. (default: false)
84
+ -o, --overwrite overwrite existing files. (default: false)
85
+ -c, --cwd <cwd> the working directory. defaults to the current directory.
86
+ -p, --path <path> the path to add the component to.
87
+ -h, --help display help for command
130
88
```
131
89
132
- ## diff (experimental)
133
-
134
- You can use the diff command to check for updates against the registry.
90
+ ## Monorepo
135
91
136
- Run the following command to get a list of components that have updates available:
92
+ In a monorepo, you can specify the path to your workspace with the ` -c ` or ` --cwd ` option.
137
93
138
94
``` bash
139
- npx @udecode/ plate-ui@latest diff
95
+ npx shadcx@latest init -u https://platejs.org/r -n plate-ui -c ./apps/www
140
96
```
141
97
142
- ```txt
143
- The following components have updates available:
144
- - blockquote-element
145
- - /path/to/my-app/components/ui/blockquote-element.tsx
146
- - button
147
- - /path/to/my-app/components/ui/button.tsx
148
- - combobox
149
- - /path/to/my-app/components/ui/combobox.ts
150
- ```
151
-
152
- Then run `diff [component]` to see the changes:
98
+ or
153
99
154
100
``` bash
155
- npx @udecode/plate-ui@ latest diff blockquote-element
101
+ npx shadcx@ latest add align-dropdown-menu -c ./apps/www
156
102
```
157
103
158
- ```diff /pl-6/
159
- ref={ref}
160
- - className={cn('my-1 border-l-2 pl-4 italic', className)}
161
- + className={cn('my-1 border-l-2 pl-6 italic', className)}
162
- {...props}
104
+ ## Example components.json
105
+
106
+ Here's an example ` components.json ` file configured for <Link href = " https://ui.shadcn.com/" >shadcn/ui</Link > and Plate UI:
107
+
108
+ ``` json
109
+ {
110
+ "style" : " default" ,
111
+ "tailwind" : {
112
+ "config" : " tailwind.config.js" ,
113
+ "css" : " app/globals.css" ,
114
+ "baseColor" : " slate" ,
115
+ "cssVariables" : true
116
+ },
117
+ "aliases" : {
118
+ "components" : " @/components" ,
119
+ "utils" : " @/lib/utils"
120
+ },
121
+ "registries" : {
122
+ "plate-ui" : {
123
+ "url" : " https://platejs.org/r" ,
124
+ "style" : " default" ,
125
+ "aliases" : {
126
+ "ui" : " @/components/plate-ui"
127
+ }
128
+ }
129
+ }
130
+ }
163
131
```
164
-
165
- ### Options
166
-
167
- ```txt
168
- Usage: @udecode/plate-ui diff [options] [component]
169
-
170
- check for updates against the registry
171
-
172
- Arguments:
173
- component the component name
174
-
175
- Options:
176
- -y, --yes skip confirmation prompt. (default: false)
177
- -c, --cwd <cwd> the working directory. defaults to the current directory.
178
- -h, --help display help for command
179
- ``` */ }
0 commit comments