@@ -160,27 +160,14 @@ import { InstallCommand } from 'react-install-command';
160
160
### Customization
161
161
162
162
``` tsx
163
- // Custom prefix and copy icon
164
- <InstallCommand
165
- packageName = " your-package"
166
- commandPrefix = " →"
167
- copyIcon = { () => (
168
- <Icon
169
- icon = " lucide:clipboard-copy"
170
- width = { 24 }
171
- height = { 24 }
172
- aria-label = " Copy to clipboard"
173
- />
174
- )}
175
- />
176
-
177
163
// Custom class names
178
164
<InstallCommand
179
165
packageName = " your-package"
180
166
slotClassNames = { {
181
167
root: " custom-root" ,
182
168
navigation: " custom-nav" ,
183
169
tab: " custom-tab" ,
170
+ tabIndicator: " install-block-tab-indicator-centered" , // Centered indicator
184
171
commandContainer: " custom-container" ,
185
172
commandPrefix: " custom-prefix" ,
186
173
commandText: " custom-text" ,
@@ -193,41 +180,70 @@ import { InstallCommand } from 'react-install-command';
193
180
}}
194
181
/>
195
182
196
- // Full slot customization
183
+ // Full customization with CSS classes
197
184
<InstallCommand
198
185
packageName = " your-package"
199
- slots = { {
200
- root : ({ children , className }) => (
201
- <div className = { className } style = { { border: " 2px solid purple" }} >
202
- { children }
203
- </div >
204
- ),
205
- navigation : ({ children }) => (
206
- <nav style = { { background: " #f0f0f0" , padding: " 8px" }} >{ children } </nav >
207
- ),
208
- tab : ({ children , isSelected , onClick }) => (
209
- <button
210
- onClick = { onClick }
211
- style = { {
212
- background: isSelected ? " purple" : " transparent" ,
213
- color: isSelected ? " white" : " black"
214
- }}
215
- >
216
- { children }
217
- </button >
218
- ),
219
- commandContainer : ({ children }) => (
220
- <div style = { { padding: " 16px" , background: " #fafafa" }} >{ children } </div >
221
- ),
222
- commandPrefix : () => <span style = { { color: " purple" }} >$</span >,
223
- commandText : ({ children }) => (
224
- <code style = { { color: " purple" }} >{ children } </code >
225
- ),
226
- copyButton : ({ onClick }) => (
227
- <button onClick = { onClick } style = { { background: " purple" , color: " white" }} >
228
- Copy
229
- </button >
230
- )
186
+ slotClassNames = { {
187
+ root: " border-2 border-purple-500 rounded-lg" ,
188
+ navigation: " bg-gray-100 p-2" ,
189
+ tab: " bg-transparent hover:bg-purple-50 text-black data-[state=active]:bg-purple-500 data-[state=active]:text-white px-2 py-1 mx-1 rounded" ,
190
+ tabIndicator: " install-block-tab-indicator-gradient" , // Gradient indicator
191
+ commandContainer: " p-4 bg-gray-50" ,
192
+ commandPrefix: " text-purple-500" ,
193
+ commandText: " text-purple-500 font-mono" ,
194
+ copyButton: " bg-purple-500 text-white px-2 py-1 rounded border-0"
195
+ }}
196
+ />
197
+ ```
198
+
199
+ ### Built-in Indicator Variants
200
+
201
+ The component comes with several built-in indicator variants that you can use:
202
+
203
+ 1 . Default indicator (full width):
204
+ ``` tsx
205
+ <InstallCommand packageName = " your-package" />
206
+ ```
207
+
208
+ 2 . Centered indicator:
209
+ ``` tsx
210
+ <InstallCommand
211
+ packageName = " your-package"
212
+ slotClassNames = { {
213
+ tabIndicator: " install-block-tab-indicator-centered"
214
+ }}
215
+ />
216
+ ```
217
+
218
+ 3 . Gradient indicator:
219
+ ``` tsx
220
+ <InstallCommand
221
+ packageName = " your-package"
222
+ slotClassNames = { {
223
+ tabIndicator: " install-block-tab-indicator-gradient"
224
+ }}
225
+ />
226
+ ```
227
+
228
+ You can also create your own indicator styles by extending these classes or creating new ones in your CSS:
229
+
230
+ ``` css
231
+ .my-custom-indicator {
232
+ left : 15% ;
233
+ width : 70% ;
234
+ height : 3px ;
235
+ border-radius : 1.5px ;
236
+ background : linear-gradient (90deg , var (--primary ), var (--accent ));
237
+ box-shadow : 0 1px 2px rgba (0 , 0 , 0 , 0.1 );
238
+ }
239
+ ```
240
+
241
+ Then use it in your component:
242
+ ``` tsx
243
+ <InstallCommand
244
+ packageName = " your-package"
245
+ slotClassNames = { {
246
+ tabIndicator: " my-custom-indicator"
231
247
}}
232
248
/>
233
249
```
0 commit comments