agents-templated 2.2.7 → 2.2.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 +2 -0
- package/bin/cli.js +7 -6
- package/lib/instructions.js +6 -6
- package/package.json +1 -1
- package/templates/README.md +1 -0
- package/templates/agents/skills/README.md +1 -0
- package/templates/agents/skills/shadcn-ui/SKILL.md +1932 -0
- package/templates/agents/skills/shadcn-ui/references/chart.md +306 -0
- package/templates/agents/skills/shadcn-ui/references/learn.md +145 -0
- package/templates/agents/skills/shadcn-ui/references/official-ui-reference.md +1729 -0
- package/templates/agents/skills/shadcn-ui/references/reference.md +586 -0
- package/templates/agents/skills/shadcn-ui/references/ui-reference.md +1578 -0
- package/templates/.github/copilot-instructions.md +0 -9
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
### shadcn/ui Chart Component - Installation
|
|
2
|
+
|
|
3
|
+
Source: https://ui.shadcn.com/docs/components/chart
|
|
4
|
+
|
|
5
|
+
The chart component in shadcn/ui is built on Recharts, providing direct access to all Recharts capabilities with consistent theming.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx shadcn@latest add chart
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
--------------------------------
|
|
12
|
+
|
|
13
|
+
### shadcn/ui Chart Component - Basic Usage
|
|
14
|
+
|
|
15
|
+
Source: https://ui.shadcn.com/docs/components/chart
|
|
16
|
+
|
|
17
|
+
The ChartContainer wraps your Recharts component and accepts a config prop for theming. Requires `min-h-[value]` for responsiveness.
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
import { Bar, BarChart, CartesianGrid, XAxis, YAxis } from "recharts"
|
|
21
|
+
import { ChartContainer, ChartTooltipContent } from "@/components/ui/chart"
|
|
22
|
+
|
|
23
|
+
const chartConfig = {
|
|
24
|
+
desktop: {
|
|
25
|
+
label: "Desktop",
|
|
26
|
+
color: "var(--chart-1)",
|
|
27
|
+
},
|
|
28
|
+
mobile: {
|
|
29
|
+
label: "Mobile",
|
|
30
|
+
color: "var(--chart-2)",
|
|
31
|
+
},
|
|
32
|
+
} satisfies import("@/components/ui/chart").ChartConfig
|
|
33
|
+
|
|
34
|
+
const chartData = [
|
|
35
|
+
{ month: "January", desktop: 186, mobile: 80 },
|
|
36
|
+
{ month: "February", desktop: 305, mobile: 200 },
|
|
37
|
+
{ month: "March", desktop: 237, mobile: 120 },
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
export function BarChartDemo() {
|
|
41
|
+
return (
|
|
42
|
+
<ChartContainer config={chartConfig} className="min-h-[200px] w-full">
|
|
43
|
+
<BarChart data={chartData}>
|
|
44
|
+
<CartesianGrid vertical={false} />
|
|
45
|
+
<XAxis dataKey="month" tickLine={false} axisLine={false} />
|
|
46
|
+
<Bar dataKey="desktop" fill="var(--color-desktop)" radius={4} />
|
|
47
|
+
<Bar dataKey="mobile" fill="var(--color-mobile)" radius={4} />
|
|
48
|
+
<ChartTooltip content={<ChartTooltipContent />} />
|
|
49
|
+
</BarChart>
|
|
50
|
+
</ChartContainer>
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
--------------------------------
|
|
56
|
+
|
|
57
|
+
### shadcn/ui Chart Component - ChartConfig with Custom Colors
|
|
58
|
+
|
|
59
|
+
Source: https://ui.shadcn.com/docs/components/chart
|
|
60
|
+
|
|
61
|
+
You can define custom colors directly in the configuration using hex values or CSS variables.
|
|
62
|
+
|
|
63
|
+
```tsx
|
|
64
|
+
const chartConfig = {
|
|
65
|
+
desktop: {
|
|
66
|
+
label: "Desktop",
|
|
67
|
+
color: "#2563eb",
|
|
68
|
+
theme: {
|
|
69
|
+
light: "#2563eb",
|
|
70
|
+
dark: "#60a5fa",
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
mobile: {
|
|
74
|
+
label: "Mobile",
|
|
75
|
+
color: "var(--chart-2)",
|
|
76
|
+
},
|
|
77
|
+
} satisfies import("@/components/ui/chart").ChartConfig
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
--------------------------------
|
|
81
|
+
|
|
82
|
+
### shadcn/ui Chart Component - CSS Variables
|
|
83
|
+
|
|
84
|
+
Source: https://ui.shadcn.com/docs/components/chart
|
|
85
|
+
|
|
86
|
+
Add chart color variables to your globals.css for consistent theming.
|
|
87
|
+
|
|
88
|
+
```css
|
|
89
|
+
:root {
|
|
90
|
+
/* Chart colors */
|
|
91
|
+
--chart-1: oklch(0.646 0.222 41.116);
|
|
92
|
+
--chart-2: oklch(0.6 0.118 184.704);
|
|
93
|
+
--chart-3: oklch(0.546 0.198 38.228);
|
|
94
|
+
--chart-4: oklch(0.596 0.151 343.253);
|
|
95
|
+
--chart-5: oklch(0.546 0.158 49.157);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.dark {
|
|
99
|
+
--chart-1: oklch(0.488 0.243 264.376);
|
|
100
|
+
--chart-2: oklch(0.696 0.17 162.48);
|
|
101
|
+
--chart-3: oklch(0.698 0.141 24.311);
|
|
102
|
+
--chart-4: oklch(0.676 0.172 171.196);
|
|
103
|
+
--chart-5: oklch(0.578 0.192 302.85);
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
--------------------------------
|
|
108
|
+
|
|
109
|
+
### shadcn/ui Chart Component - Line Chart Example
|
|
110
|
+
|
|
111
|
+
Source: https://ui.shadcn.com/docs/components/chart
|
|
112
|
+
|
|
113
|
+
Creating a line chart with shadcn/ui charts component.
|
|
114
|
+
|
|
115
|
+
```tsx
|
|
116
|
+
import { Line, LineChart, CartesianGrid, XAxis, YAxis } from "recharts"
|
|
117
|
+
import { ChartContainer, ChartTooltipContent } from "@/components/ui/chart"
|
|
118
|
+
|
|
119
|
+
const chartConfig = {
|
|
120
|
+
price: {
|
|
121
|
+
label: "Price",
|
|
122
|
+
color: "var(--chart-1)",
|
|
123
|
+
},
|
|
124
|
+
} satisfies import("@/components/ui/chart").ChartConfig
|
|
125
|
+
|
|
126
|
+
const chartData = [
|
|
127
|
+
{ month: "January", price: 186 },
|
|
128
|
+
{ month: "February", price: 305 },
|
|
129
|
+
{ month: "March", price: 237 },
|
|
130
|
+
{ month: "April", price: 203 },
|
|
131
|
+
{ month: "May", price: 276 },
|
|
132
|
+
]
|
|
133
|
+
|
|
134
|
+
export function LineChartDemo() {
|
|
135
|
+
return (
|
|
136
|
+
<ChartContainer config={chartConfig} className="min-h-[200px]">
|
|
137
|
+
<LineChart data={chartData}>
|
|
138
|
+
<CartesianGrid vertical={false} />
|
|
139
|
+
<XAxis dataKey="month" tickLine={false} axisLine={false} />
|
|
140
|
+
<YAxis tickLine={false} axisLine={false} tickFormatter={(value) => `$${value}`} />
|
|
141
|
+
<Line
|
|
142
|
+
dataKey="price"
|
|
143
|
+
stroke="var(--color-price)"
|
|
144
|
+
strokeWidth={2}
|
|
145
|
+
dot={false}
|
|
146
|
+
/>
|
|
147
|
+
<ChartTooltip content={<ChartTooltipContent />} />
|
|
148
|
+
</LineChart>
|
|
149
|
+
</ChartContainer>
|
|
150
|
+
)
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
--------------------------------
|
|
155
|
+
|
|
156
|
+
### shadcn/ui Chart Component - Area Chart Example
|
|
157
|
+
|
|
158
|
+
Source: https://ui.shadcn.com/docs/components/chart
|
|
159
|
+
|
|
160
|
+
Creating an area chart with gradient fill and legend.
|
|
161
|
+
|
|
162
|
+
```tsx
|
|
163
|
+
import { Area, AreaChart, XAxis, YAxis } from "recharts"
|
|
164
|
+
import {
|
|
165
|
+
ChartContainer,
|
|
166
|
+
ChartLegend,
|
|
167
|
+
ChartLegendContent,
|
|
168
|
+
ChartTooltipContent,
|
|
169
|
+
} from "@/components/ui/chart"
|
|
170
|
+
|
|
171
|
+
const chartConfig = {
|
|
172
|
+
desktop: { label: "Desktop", color: "var(--chart-1)" },
|
|
173
|
+
mobile: { label: "Mobile", color: "var(--chart-2)" },
|
|
174
|
+
} satisfies import("@/components/ui/chart").ChartConfig
|
|
175
|
+
|
|
176
|
+
export function AreaChartDemo() {
|
|
177
|
+
return (
|
|
178
|
+
<ChartContainer config={chartConfig} className="min-h-[200px]">
|
|
179
|
+
<AreaChart data={chartData}>
|
|
180
|
+
<XAxis dataKey="month" tickLine={false} axisLine={false} />
|
|
181
|
+
<YAxis tickLine={false} axisLine={false} />
|
|
182
|
+
<Area
|
|
183
|
+
dataKey="desktop"
|
|
184
|
+
fill="var(--color-desktop)"
|
|
185
|
+
stroke="var(--color-desktop)"
|
|
186
|
+
fillOpacity={0.3}
|
|
187
|
+
/>
|
|
188
|
+
<Area
|
|
189
|
+
dataKey="mobile"
|
|
190
|
+
fill="var(--color-mobile)"
|
|
191
|
+
stroke="var(--color-mobile)"
|
|
192
|
+
fillOpacity={0.3}
|
|
193
|
+
/>
|
|
194
|
+
<ChartTooltip content={<ChartTooltipContent />} />
|
|
195
|
+
<ChartLegend content={<ChartLegendContent />} />
|
|
196
|
+
</AreaChart>
|
|
197
|
+
</ChartContainer>
|
|
198
|
+
)
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
--------------------------------
|
|
203
|
+
|
|
204
|
+
### shadcn/ui Chart Component - Pie Chart Example
|
|
205
|
+
|
|
206
|
+
Source: https://ui.shadcn.com/docs/components/chart
|
|
207
|
+
|
|
208
|
+
Creating a pie/donut chart with shadcn/ui.
|
|
209
|
+
|
|
210
|
+
```tsx
|
|
211
|
+
import { Pie, PieChart } from "recharts"
|
|
212
|
+
import {
|
|
213
|
+
ChartContainer,
|
|
214
|
+
ChartLegend,
|
|
215
|
+
ChartLegendContent,
|
|
216
|
+
ChartTooltipContent,
|
|
217
|
+
} from "@/components/ui/chart"
|
|
218
|
+
|
|
219
|
+
const chartConfig = {
|
|
220
|
+
chrome: { label: "Chrome", color: "var(--chart-1)" },
|
|
221
|
+
safari: { label: "Safari", color: "var(--chart-2)" },
|
|
222
|
+
firefox: { label: "Firefox", color: "var(--chart-3)" },
|
|
223
|
+
} satisfies import("@/components/ui/chart").ChartConfig
|
|
224
|
+
|
|
225
|
+
const pieData = [
|
|
226
|
+
{ browser: "Chrome", visitors: 275, fill: "var(--color-chrome)" },
|
|
227
|
+
{ browser: "Safari", visitors: 200, fill: "var(--color-safari)" },
|
|
228
|
+
{ browser: "Firefox", visitors: 187, fill: "var(--color-firefox)" },
|
|
229
|
+
]
|
|
230
|
+
|
|
231
|
+
export function PieChartDemo() {
|
|
232
|
+
return (
|
|
233
|
+
<ChartContainer config={chartConfig} className="min-h-[200px]">
|
|
234
|
+
<PieChart>
|
|
235
|
+
<Pie
|
|
236
|
+
data={pieData}
|
|
237
|
+
dataKey="visitors"
|
|
238
|
+
nameKey="browser"
|
|
239
|
+
cx="50%"
|
|
240
|
+
cy="50%"
|
|
241
|
+
outerRadius={80}
|
|
242
|
+
/>
|
|
243
|
+
<ChartTooltip content={<ChartTooltipContent />} />
|
|
244
|
+
<ChartLegend content={<ChartLegendContent />} />
|
|
245
|
+
</PieChart>
|
|
246
|
+
</ChartContainer>
|
|
247
|
+
)
|
|
248
|
+
}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
--------------------------------
|
|
252
|
+
|
|
253
|
+
### shadcn/ui ChartTooltipContent Props
|
|
254
|
+
|
|
255
|
+
Source: https://ui.shadcn.com/docs/components/chart
|
|
256
|
+
|
|
257
|
+
The ChartTooltipContent component accepts these props for customizing tooltip behavior.
|
|
258
|
+
|
|
259
|
+
| Prop | Type | Default | Description |
|
|
260
|
+
|------|------|---------|-------------|
|
|
261
|
+
| `labelKey` | string | "label" | Key for tooltip label |
|
|
262
|
+
| `nameKey` | string | "name" | Key for tooltip name |
|
|
263
|
+
| `indicator` | "dot" \| "line" \| "dashed" | "dot" | Indicator style |
|
|
264
|
+
| `hideLabel` | boolean | false | Hide label |
|
|
265
|
+
| `hideIndicator` | boolean | false | Hide indicator |
|
|
266
|
+
|
|
267
|
+
--------------------------------
|
|
268
|
+
|
|
269
|
+
### shadcn/ui Chart Component - Accessibility
|
|
270
|
+
|
|
271
|
+
Source: https://ui.shadcn.com/docs/components/chart
|
|
272
|
+
|
|
273
|
+
Enable keyboard navigation and screen reader support by adding the accessibilityLayer prop.
|
|
274
|
+
|
|
275
|
+
```tsx
|
|
276
|
+
<BarChart accessibilityLayer data={chartData}>
|
|
277
|
+
<CartesianGrid vertical={false} />
|
|
278
|
+
<XAxis dataKey="month" />
|
|
279
|
+
<Bar dataKey="desktop" fill="var(--color-desktop)" />
|
|
280
|
+
<ChartTooltip content={<ChartTooltipContent />} />
|
|
281
|
+
</BarChart>
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
This adds:
|
|
285
|
+
- Keyboard arrow key navigation
|
|
286
|
+
- ARIA labels for chart elements
|
|
287
|
+
- Screen reader announcements for data values
|
|
288
|
+
|
|
289
|
+
--------------------------------
|
|
290
|
+
|
|
291
|
+
### shadcn/ui Chart Component - Recharts Dependencies
|
|
292
|
+
|
|
293
|
+
Source: https://ui.shadcn.com/docs/components/chart
|
|
294
|
+
|
|
295
|
+
The chart component requires the following Recharts dependencies to be installed.
|
|
296
|
+
|
|
297
|
+
```bash
|
|
298
|
+
pnpm add recharts
|
|
299
|
+
npm install recharts
|
|
300
|
+
yarn add recharts
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
Recharts provides the following chart types:
|
|
304
|
+
- Area, Bar, Line, Pie, Composed
|
|
305
|
+
- Radar, RadialBar, Scatter
|
|
306
|
+
- Funnel, Treemap
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
# shadcn/ui Learning Guide
|
|
2
|
+
|
|
3
|
+
This guide helps you learn shadcn/ui from basics to advanced patterns.
|
|
4
|
+
|
|
5
|
+
## Learning Path
|
|
6
|
+
|
|
7
|
+
### 1. Understanding the Philosophy
|
|
8
|
+
|
|
9
|
+
shadcn/ui is different from traditional component libraries:
|
|
10
|
+
|
|
11
|
+
- **Copy-paste components**: Components are copied into your project, not installed as packages
|
|
12
|
+
- **Full customization**: You own the code and can modify it freely
|
|
13
|
+
- **Built on Radix UI**: Provides accessibility primitives
|
|
14
|
+
- **Styled with Tailwind**: Uses utility classes for consistent styling
|
|
15
|
+
|
|
16
|
+
### 2. Core Concepts to Master
|
|
17
|
+
|
|
18
|
+
#### Class Variance Authority (CVA)
|
|
19
|
+
Most components use CVA for variant management:
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
const buttonVariants = cva(
|
|
23
|
+
"base-classes",
|
|
24
|
+
{
|
|
25
|
+
variants: {
|
|
26
|
+
variant: {
|
|
27
|
+
default: "variant-classes",
|
|
28
|
+
destructive: "destructive-classes",
|
|
29
|
+
},
|
|
30
|
+
size: {
|
|
31
|
+
default: "size-classes",
|
|
32
|
+
sm: "small-classes",
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
defaultVariants: {
|
|
36
|
+
variant: "default",
|
|
37
|
+
size: "default",
|
|
38
|
+
},
|
|
39
|
+
}
|
|
40
|
+
)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
#### cn Utility Function
|
|
44
|
+
The `cn` function combines classes and resolves conflicts:
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
import { clsx, type ClassValue } from "clsx"
|
|
48
|
+
import { twMerge } from "tailwind-merge"
|
|
49
|
+
|
|
50
|
+
export function cn(...inputs: ClassValue[]) {
|
|
51
|
+
return twMerge(clsx(inputs))
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### 3. Installation Checklist
|
|
56
|
+
|
|
57
|
+
- [ ] Initialize a new project (Next.js, Vite, or Remix)
|
|
58
|
+
- [ ] Install Tailwind CSS
|
|
59
|
+
- [ ] Run `npx shadcn@latest init`
|
|
60
|
+
- [ ] Configure CSS variables
|
|
61
|
+
- [ ] Install first component: `npx shadcn@latest add button`
|
|
62
|
+
|
|
63
|
+
### 4. Essential Components to Learn First
|
|
64
|
+
|
|
65
|
+
1. **Button** - Learn variants and sizes
|
|
66
|
+
2. **Input** - Form inputs with labels
|
|
67
|
+
3. **Card** - Container components
|
|
68
|
+
4. **Form** - Form handling with React Hook Form
|
|
69
|
+
5. **Dialog** - Modal windows
|
|
70
|
+
6. **Select** - Dropdown selections
|
|
71
|
+
7. **Toast** - Notifications
|
|
72
|
+
|
|
73
|
+
### 5. Common Patterns
|
|
74
|
+
|
|
75
|
+
#### Form Pattern
|
|
76
|
+
Every form follows this structure:
|
|
77
|
+
|
|
78
|
+
```tsx
|
|
79
|
+
1. Define Zod schema
|
|
80
|
+
2. Create form with useForm
|
|
81
|
+
3. Wrap with Form component
|
|
82
|
+
4. Add FormField for each input
|
|
83
|
+
5. Handle submission
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
#### Component Customization Pattern
|
|
87
|
+
To customize a component:
|
|
88
|
+
|
|
89
|
+
1. Copy component to your project
|
|
90
|
+
2. Modify the variants
|
|
91
|
+
3. Add new props if needed
|
|
92
|
+
4. Update types
|
|
93
|
+
|
|
94
|
+
### 6. Best Practices
|
|
95
|
+
|
|
96
|
+
- Always use TypeScript
|
|
97
|
+
- Follow the existing component structure
|
|
98
|
+
- Use semantic HTML when possible
|
|
99
|
+
- Test with screen readers for accessibility
|
|
100
|
+
- Keep components small and focused
|
|
101
|
+
|
|
102
|
+
### 7. Advanced Topics
|
|
103
|
+
|
|
104
|
+
- Creating custom components from scratch
|
|
105
|
+
- Building complex forms with validation
|
|
106
|
+
- Implementing dark mode
|
|
107
|
+
- Optimizing for performance
|
|
108
|
+
- Testing components
|
|
109
|
+
|
|
110
|
+
## Practice Exercises
|
|
111
|
+
|
|
112
|
+
### Exercise 1: Basic Setup
|
|
113
|
+
1. Create a new Next.js project
|
|
114
|
+
2. Set up shadcn/ui
|
|
115
|
+
3. Install and customize a Button component
|
|
116
|
+
4. Add a new variant "gradient"
|
|
117
|
+
|
|
118
|
+
### Exercise 2: Form Building
|
|
119
|
+
1. Create a contact form with:
|
|
120
|
+
- Name input (required)
|
|
121
|
+
- Email input (email validation)
|
|
122
|
+
- Message textarea (min length)
|
|
123
|
+
- Submit button with loading state
|
|
124
|
+
|
|
125
|
+
### Exercise 3: Component Combination
|
|
126
|
+
1. Build a settings page using:
|
|
127
|
+
- Card for layout
|
|
128
|
+
- Sheet for mobile menu
|
|
129
|
+
- Select for dropdowns
|
|
130
|
+
- Switch for toggles
|
|
131
|
+
- Toast for notifications
|
|
132
|
+
|
|
133
|
+
### Exercise 4: Custom Component
|
|
134
|
+
1. Create a custom Badge component
|
|
135
|
+
2. Support variants: default, secondary, destructive, outline
|
|
136
|
+
3. Support sizes: sm, default, lg
|
|
137
|
+
4. Add icon support
|
|
138
|
+
|
|
139
|
+
## Resources
|
|
140
|
+
|
|
141
|
+
- [Official Documentation](https://ui.shadcn.com)
|
|
142
|
+
- [GitHub Repository](https://github.com/shadcn/ui)
|
|
143
|
+
- [Examples Gallery](https://ui.shadcn.com/examples)
|
|
144
|
+
- [Radix UI Primitives](https://www.radix-ui.com/primitives)
|
|
145
|
+
- [Tailwind CSS Documentation](https://tailwindcss.com/docs)
|