shadcn-ui-react 0.7.6 → 0.7.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +135 -48
- package/dist/index.cjs +1087 -874
- package/dist/index.d.cts +38 -19
- package/dist/index.d.ts +38 -19
- package/dist/index.js +1089 -871
- package/dist/style.css +67 -6
- package/package.json +6 -5
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# 🧩 shadcn-ui-react
|
|
2
2
|
|
|
3
|
-
A
|
|
3
|
+
A production-ready React UI library that packages `shadcn/ui` components into a single reusable library, with Tailwind CSS styling, Radix UI primitives, form helpers, and ready-to-use demos.
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -22,11 +22,11 @@ npm install react react-dom
|
|
|
22
22
|
|
|
23
23
|
---
|
|
24
24
|
|
|
25
|
-
## 🚀 Getting
|
|
25
|
+
## 🚀 Getting started
|
|
26
26
|
|
|
27
|
-
### 1. Import global styles
|
|
27
|
+
### 1. Import the global styles
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
Import the package stylesheet once in your app entry file, layout, or root component.
|
|
30
30
|
|
|
31
31
|
```tsx
|
|
32
32
|
import 'shadcn-ui-react/dist/style.css';
|
|
@@ -39,11 +39,9 @@ import { Button } from 'shadcn-ui-react';
|
|
|
39
39
|
|
|
40
40
|
export default function App() {
|
|
41
41
|
return (
|
|
42
|
-
<div className="p-6">
|
|
42
|
+
<div className="flex gap-3 p-6">
|
|
43
43
|
<Button>Save</Button>
|
|
44
|
-
<Button variant="outline"
|
|
45
|
-
Cancel
|
|
46
|
-
</Button>
|
|
44
|
+
<Button variant="outline">Cancel</Button>
|
|
47
45
|
</div>
|
|
48
46
|
);
|
|
49
47
|
}
|
|
@@ -51,46 +49,103 @@ export default function App() {
|
|
|
51
49
|
|
|
52
50
|
---
|
|
53
51
|
|
|
54
|
-
##
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
52
|
+
## 🧱 Available Components
|
|
53
|
+
|
|
54
|
+
### 📦 UI Primitives
|
|
55
|
+
|
|
56
|
+
- `Accordion`
|
|
57
|
+
- `Alert`
|
|
58
|
+
- `AlertDialog`
|
|
59
|
+
- `Avatar`
|
|
60
|
+
- `Badge`
|
|
61
|
+
- `Breadcrumb`
|
|
62
|
+
- `Button`
|
|
63
|
+
- `IconButton`
|
|
64
|
+
- `Calendar`
|
|
65
|
+
- `Card`
|
|
66
|
+
- `Carousel`
|
|
67
|
+
- `Checkbox`
|
|
68
|
+
- `Collapsible`
|
|
69
|
+
- `Command`
|
|
70
|
+
- `ContextMenu`
|
|
71
|
+
- `Dialog`
|
|
72
|
+
- `Drawer`
|
|
73
|
+
- `DropdownMenu`
|
|
74
|
+
- `HoverCard`
|
|
75
|
+
- `Input`
|
|
76
|
+
- `InputOtp`
|
|
77
|
+
- `Label`
|
|
78
|
+
- `Menubar`
|
|
79
|
+
- `Modal`
|
|
80
|
+
- `NavigationMenu`
|
|
81
|
+
- `Pagination`
|
|
82
|
+
- `Popover`
|
|
83
|
+
- `Progress`
|
|
84
|
+
- `RadioGroup`
|
|
85
|
+
- `Resizable`
|
|
86
|
+
- `ScrollArea`
|
|
87
|
+
- `Select`
|
|
88
|
+
- `Separator`
|
|
89
|
+
- `Sheet`
|
|
90
|
+
- `Skeleton`
|
|
91
|
+
- `Slider`
|
|
92
|
+
- `Sonner`
|
|
93
|
+
- `Switch`
|
|
94
|
+
- `Table`
|
|
95
|
+
- `Tabs`
|
|
96
|
+
- `Textarea`
|
|
97
|
+
- `Toast`
|
|
98
|
+
- `Toaster`
|
|
99
|
+
- `Toggle`
|
|
100
|
+
- `ToggleGroup`
|
|
101
|
+
- `Tooltip`
|
|
68
102
|
|
|
69
103
|
---
|
|
70
104
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
105
|
+
### 🧠 Forms
|
|
106
|
+
|
|
107
|
+
- `Form`
|
|
108
|
+
- `FormField`
|
|
109
|
+
- `FormSelect`
|
|
110
|
+
- `FormCheckbox`
|
|
111
|
+
- `FormItem`
|
|
112
|
+
- `FormControl`
|
|
113
|
+
- `FormLabel`
|
|
114
|
+
- `FormDescription`
|
|
115
|
+
- `FormMessage`
|
|
116
|
+
- `UiInput`
|
|
117
|
+
- `UiSelect`
|
|
118
|
+
- `UiCheckbox`
|
|
74
119
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
### Form helpers
|
|
120
|
+
---
|
|
78
121
|
|
|
79
|
-
|
|
122
|
+
### 🧩 Shared Components
|
|
80
123
|
|
|
81
|
-
|
|
124
|
+
- `AlertModal`
|
|
125
|
+
- `Breadcrumbs`
|
|
126
|
+
- `DataTable`
|
|
127
|
+
- `DataTableSkeleton`
|
|
128
|
+
- `Dropzone`
|
|
129
|
+
- `FileUpload`
|
|
130
|
+
- `Heading`
|
|
131
|
+
- `PageHead`
|
|
132
|
+
- `PaginationSection`
|
|
133
|
+
- `SearchInput`
|
|
134
|
+
- `SearchableSelect`
|
|
82
135
|
|
|
83
|
-
|
|
136
|
+
---
|
|
84
137
|
|
|
85
|
-
### Utilities
|
|
138
|
+
### 🛠️ Utilities
|
|
86
139
|
|
|
87
|
-
`cn
|
|
140
|
+
- `cn`
|
|
141
|
+
- `useToast`
|
|
142
|
+
- `toast`
|
|
143
|
+
- `Icons`
|
|
144
|
+
- `useSidebar`
|
|
88
145
|
|
|
89
146
|
---
|
|
90
147
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
All demos use neutral sample data so they can be published in public documentation without referencing any private product, client, tenant, store, or internal business flow.
|
|
148
|
+
## ✨ Demos
|
|
94
149
|
|
|
95
150
|
## 1. Button
|
|
96
151
|
|
|
@@ -228,7 +283,7 @@ import {
|
|
|
228
283
|
|
|
229
284
|
const schema = z.object({
|
|
230
285
|
name: z.string().min(2, 'Minimum 2 characters'),
|
|
231
|
-
email: z.string().email('Invalid email'),
|
|
286
|
+
email: z.string().email('Invalid email address'),
|
|
232
287
|
password: z.string().min(8, 'Minimum 8 characters'),
|
|
233
288
|
role: z.enum(['owner', 'editor', 'viewer']),
|
|
234
289
|
accepted: z.boolean().refine(Boolean, 'You must accept the terms')
|
|
@@ -253,7 +308,11 @@ export function FormDemo() {
|
|
|
253
308
|
};
|
|
254
309
|
|
|
255
310
|
return (
|
|
256
|
-
<Form
|
|
311
|
+
<Form
|
|
312
|
+
methods={form}
|
|
313
|
+
onSubmit={onSubmit}
|
|
314
|
+
formProps={{ className: 'space-y-4' }}
|
|
315
|
+
>
|
|
257
316
|
<FormField
|
|
258
317
|
control={form.control}
|
|
259
318
|
name="name"
|
|
@@ -326,8 +385,16 @@ export function SearchableSelectDemo() {
|
|
|
326
385
|
{ label: 'Apple', value: 'apple', keywords: 'fruit red green sweet' },
|
|
327
386
|
{ label: 'Banana', value: 'banana', keywords: 'fruit yellow tropical' },
|
|
328
387
|
{ label: 'Orange', value: 'orange', keywords: 'fruit citrus vitamin c' },
|
|
329
|
-
{
|
|
330
|
-
|
|
388
|
+
{
|
|
389
|
+
label: 'Strawberry',
|
|
390
|
+
value: 'strawberry',
|
|
391
|
+
keywords: 'fruit berry red sweet'
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
label: 'Pineapple',
|
|
395
|
+
value: 'pineapple',
|
|
396
|
+
keywords: 'fruit tropical sweet'
|
|
397
|
+
}
|
|
331
398
|
]}
|
|
332
399
|
/>
|
|
333
400
|
);
|
|
@@ -350,7 +417,7 @@ export function AccordionDemo() {
|
|
|
350
417
|
<AccordionItem value="item-1">
|
|
351
418
|
<AccordionTrigger>What is included?</AccordionTrigger>
|
|
352
419
|
<AccordionContent>
|
|
353
|
-
Accessible components, Tailwind styling, and reusable form helpers.
|
|
420
|
+
Accessible components, Tailwind CSS styling, and reusable form helpers.
|
|
354
421
|
</AccordionContent>
|
|
355
422
|
</AccordionItem>
|
|
356
423
|
</Accordion>
|
|
@@ -447,6 +514,7 @@ const data: Project[] = [
|
|
|
447
514
|
export function DataTableDemo() {
|
|
448
515
|
const [page, setPage] = React.useState(1);
|
|
449
516
|
const [perPage, setPerPage] = React.useState(5);
|
|
517
|
+
|
|
450
518
|
const pageCount = Math.ceil(data.length / perPage);
|
|
451
519
|
const visibleRows = data.slice((page - 1) * perPage, page * perPage);
|
|
452
520
|
|
|
@@ -540,7 +608,7 @@ export function ToastDemo() {
|
|
|
540
608
|
|
|
541
609
|
```tsx
|
|
542
610
|
import { toast } from 'sonner';
|
|
543
|
-
import { Button,
|
|
611
|
+
import { Button, Sonner } from 'shadcn-ui-react';
|
|
544
612
|
|
|
545
613
|
export function SonnerDemo() {
|
|
546
614
|
return (
|
|
@@ -548,7 +616,8 @@ export function SonnerDemo() {
|
|
|
548
616
|
<Button onClick={() => toast.success('Operation completed')}>
|
|
549
617
|
Notify
|
|
550
618
|
</Button>
|
|
551
|
-
|
|
619
|
+
|
|
620
|
+
<Sonner />
|
|
552
621
|
</>
|
|
553
622
|
);
|
|
554
623
|
}
|
|
@@ -569,11 +638,12 @@ export function CardDemo() {
|
|
|
569
638
|
return (
|
|
570
639
|
<Card className="max-w-md">
|
|
571
640
|
<CardHeader>
|
|
572
|
-
<CardTitle className="flex items-center justify-between">
|
|
641
|
+
<CardTitle className="flex items-center justify-between gap-4">
|
|
573
642
|
Starter Kit
|
|
574
643
|
<Badge>New</Badge>
|
|
575
644
|
</CardTitle>
|
|
576
645
|
</CardHeader>
|
|
646
|
+
|
|
577
647
|
<CardContent className="text-sm text-muted-foreground">
|
|
578
648
|
A simple card example with a title, badge, and supporting description.
|
|
579
649
|
</CardContent>
|
|
@@ -594,6 +664,7 @@ export function TabsDemo() {
|
|
|
594
664
|
<TabsTrigger value="overview">Overview</TabsTrigger>
|
|
595
665
|
<TabsTrigger value="settings">Settings</TabsTrigger>
|
|
596
666
|
</TabsList>
|
|
667
|
+
|
|
597
668
|
<TabsContent value="overview">General information goes here.</TabsContent>
|
|
598
669
|
<TabsContent value="settings">Preferences and configuration go here.</TabsContent>
|
|
599
670
|
</Tabs>
|
|
@@ -605,12 +676,28 @@ export function TabsDemo() {
|
|
|
605
676
|
|
|
606
677
|
## 💅 Theming
|
|
607
678
|
|
|
608
|
-
This package uses Tailwind CSS variables. You can override the default theme from your app CSS
|
|
679
|
+
This package uses Tailwind CSS variables. You can override the default theme from your app CSS.
|
|
609
680
|
|
|
610
681
|
```css
|
|
611
682
|
:root {
|
|
612
|
-
--
|
|
613
|
-
--
|
|
683
|
+
--card: oklch(1 0 0);
|
|
684
|
+
--card-foreground: oklch(0.145 0 0);
|
|
685
|
+
--popover: oklch(1 0 0);
|
|
686
|
+
--popover-foreground: oklch(0.145 0 0);
|
|
687
|
+
--primary: oklch(0.205 0 0);
|
|
688
|
+
--primary-foreground: oklch(0.985 0 0);
|
|
689
|
+
--secondary: oklch(0.97 0 0);
|
|
690
|
+
--secondary-foreground: oklch(0.205 0 0);
|
|
691
|
+
--muted: oklch(0.97 0 0);
|
|
692
|
+
--muted-foreground: oklch(0.556 0 0);
|
|
693
|
+
--accent: oklch(0.97 0 0);
|
|
694
|
+
--accent-foreground: oklch(0.205 0 0);
|
|
695
|
+
--destructive: oklch(64.12% 0.209 16.22);
|
|
696
|
+
--destructive-foreground: oklch(97.913% 0.00011 271.152);
|
|
697
|
+
--border: oklch(0.922 0 0);
|
|
698
|
+
--input: #fdfdfd;
|
|
699
|
+
--ring: 221.2 83.2% 53.3%;
|
|
700
|
+
|
|
614
701
|
--radius: 0.75rem;
|
|
615
702
|
}
|
|
616
703
|
```
|
|
@@ -619,4 +706,4 @@ This package uses Tailwind CSS variables. You can override the default theme fro
|
|
|
619
706
|
|
|
620
707
|
## 📝 License
|
|
621
708
|
|
|
622
|
-
MIT.
|
|
709
|
+
MIT.
|