@lglab/compose-ui-mcp 0.0.1
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 +11 -0
- package/dist/assets/llms/accordion.md +184 -0
- package/dist/assets/llms/alert-dialog.md +306 -0
- package/dist/assets/llms/autocomplete.md +756 -0
- package/dist/assets/llms/avatar.md +166 -0
- package/dist/assets/llms/badge.md +478 -0
- package/dist/assets/llms/button.md +238 -0
- package/dist/assets/llms/card.md +264 -0
- package/dist/assets/llms/checkbox-group.md +158 -0
- package/dist/assets/llms/checkbox.md +83 -0
- package/dist/assets/llms/collapsible.md +165 -0
- package/dist/assets/llms/combobox.md +1255 -0
- package/dist/assets/llms/context-menu.md +371 -0
- package/dist/assets/llms/dialog.md +592 -0
- package/dist/assets/llms/drawer.md +437 -0
- package/dist/assets/llms/field.md +74 -0
- package/dist/assets/llms/form.md +1931 -0
- package/dist/assets/llms/input.md +47 -0
- package/dist/assets/llms/menu.md +484 -0
- package/dist/assets/llms/menubar.md +804 -0
- package/dist/assets/llms/meter.md +181 -0
- package/dist/assets/llms/navigation-menu.md +187 -0
- package/dist/assets/llms/number-field.md +243 -0
- package/dist/assets/llms/pagination.md +514 -0
- package/dist/assets/llms/popover.md +206 -0
- package/dist/assets/llms/preview-card.md +146 -0
- package/dist/assets/llms/progress.md +60 -0
- package/dist/assets/llms/radio-group.md +105 -0
- package/dist/assets/llms/scroll-area.md +132 -0
- package/dist/assets/llms/select.md +276 -0
- package/dist/assets/llms/separator.md +49 -0
- package/dist/assets/llms/skeleton.md +96 -0
- package/dist/assets/llms/slider.md +161 -0
- package/dist/assets/llms/switch.md +101 -0
- package/dist/assets/llms/table.md +1325 -0
- package/dist/assets/llms/tabs.md +327 -0
- package/dist/assets/llms/textarea.md +38 -0
- package/dist/assets/llms/toast.md +349 -0
- package/dist/assets/llms/toggle-group.md +261 -0
- package/dist/assets/llms/toggle.md +161 -0
- package/dist/assets/llms/toolbar.md +148 -0
- package/dist/assets/llms/tooltip.md +486 -0
- package/dist/assets/llms-full.txt +14515 -0
- package/dist/assets/llms.txt +65 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +161 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
# Button
|
|
2
|
+
|
|
3
|
+
A versatile button component with multiple variants, sizes, and states including loading indicators.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @lglab/compose-ui
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Import
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { Button } from '@lglab/compose-ui'
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Examples
|
|
18
|
+
|
|
19
|
+
### Default
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
import { Button } from '@lglab/compose-ui/button'
|
|
23
|
+
import { TrashIcon } from 'lucide-react'
|
|
24
|
+
|
|
25
|
+
export default function DefaultExample() {
|
|
26
|
+
return (
|
|
27
|
+
<div className='flex items-center flex-wrap gap-2'>
|
|
28
|
+
<Button size='sm'>Small</Button>
|
|
29
|
+
<Button>Default</Button>
|
|
30
|
+
<Button size='lg'>Large</Button>
|
|
31
|
+
<Button size='icon-sm'>
|
|
32
|
+
<TrashIcon />
|
|
33
|
+
</Button>
|
|
34
|
+
<Button size='icon'>
|
|
35
|
+
<TrashIcon />
|
|
36
|
+
</Button>
|
|
37
|
+
<Button size='icon-lg'>
|
|
38
|
+
<TrashIcon />
|
|
39
|
+
</Button>
|
|
40
|
+
<Button disabled>Disabled</Button>
|
|
41
|
+
</div>
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Secondary
|
|
47
|
+
|
|
48
|
+
```tsx
|
|
49
|
+
import { Button } from '@lglab/compose-ui/button'
|
|
50
|
+
import { TrashIcon } from 'lucide-react'
|
|
51
|
+
|
|
52
|
+
export default function SecondaryExample() {
|
|
53
|
+
return (
|
|
54
|
+
<div className='flex items-center flex-wrap gap-2'>
|
|
55
|
+
<Button variant='secondary' size='sm'>
|
|
56
|
+
Small
|
|
57
|
+
</Button>
|
|
58
|
+
<Button variant='secondary'>Default</Button>
|
|
59
|
+
<Button variant='secondary' size='lg'>
|
|
60
|
+
Large
|
|
61
|
+
</Button>
|
|
62
|
+
<Button variant='secondary' size='icon-sm'>
|
|
63
|
+
<TrashIcon />
|
|
64
|
+
</Button>
|
|
65
|
+
<Button variant='secondary' size='icon'>
|
|
66
|
+
<TrashIcon />
|
|
67
|
+
</Button>
|
|
68
|
+
<Button variant='secondary' size='icon-lg'>
|
|
69
|
+
<TrashIcon />
|
|
70
|
+
</Button>
|
|
71
|
+
<Button variant='secondary' disabled>
|
|
72
|
+
Disabled
|
|
73
|
+
</Button>
|
|
74
|
+
</div>
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Outline
|
|
80
|
+
|
|
81
|
+
```tsx
|
|
82
|
+
import { Button } from '@lglab/compose-ui/button'
|
|
83
|
+
import { TrashIcon } from 'lucide-react'
|
|
84
|
+
|
|
85
|
+
export default function OutlineExample() {
|
|
86
|
+
return (
|
|
87
|
+
<div className='flex items-center flex-wrap gap-2'>
|
|
88
|
+
<Button variant='outline' size='sm'>
|
|
89
|
+
Small
|
|
90
|
+
</Button>
|
|
91
|
+
<Button variant='outline'>Default</Button>
|
|
92
|
+
<Button variant='outline' size='lg'>
|
|
93
|
+
Large
|
|
94
|
+
</Button>
|
|
95
|
+
<Button variant='outline' size='icon-sm'>
|
|
96
|
+
<TrashIcon />
|
|
97
|
+
</Button>
|
|
98
|
+
<Button variant='outline' size='icon'>
|
|
99
|
+
<TrashIcon />
|
|
100
|
+
</Button>
|
|
101
|
+
<Button variant='outline' size='icon-lg'>
|
|
102
|
+
<TrashIcon />
|
|
103
|
+
</Button>
|
|
104
|
+
<Button variant='outline' disabled>
|
|
105
|
+
Disabled
|
|
106
|
+
</Button>
|
|
107
|
+
</div>
|
|
108
|
+
)
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Destructive
|
|
113
|
+
|
|
114
|
+
```tsx
|
|
115
|
+
import { Button } from '@lglab/compose-ui/button'
|
|
116
|
+
import { TrashIcon } from 'lucide-react'
|
|
117
|
+
|
|
118
|
+
export default function DestructiveExample() {
|
|
119
|
+
return (
|
|
120
|
+
<div className='flex items-center flex-wrap gap-2'>
|
|
121
|
+
<Button variant='destructive' size='sm'>
|
|
122
|
+
Small
|
|
123
|
+
</Button>
|
|
124
|
+
<Button variant='destructive'>Default</Button>
|
|
125
|
+
<Button variant='destructive' size='lg'>
|
|
126
|
+
Large
|
|
127
|
+
</Button>
|
|
128
|
+
<Button variant='destructive' size='icon-sm'>
|
|
129
|
+
<TrashIcon />
|
|
130
|
+
</Button>
|
|
131
|
+
<Button variant='destructive' size='icon'>
|
|
132
|
+
<TrashIcon />
|
|
133
|
+
</Button>
|
|
134
|
+
<Button variant='destructive' size='icon-lg'>
|
|
135
|
+
<TrashIcon />
|
|
136
|
+
</Button>
|
|
137
|
+
<Button variant='destructive' disabled>
|
|
138
|
+
Disabled
|
|
139
|
+
</Button>
|
|
140
|
+
</div>
|
|
141
|
+
)
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Ghost
|
|
146
|
+
|
|
147
|
+
```tsx
|
|
148
|
+
import { Button } from '@lglab/compose-ui/button'
|
|
149
|
+
import { TrashIcon } from 'lucide-react'
|
|
150
|
+
|
|
151
|
+
export default function GhostExample() {
|
|
152
|
+
return (
|
|
153
|
+
<div className='flex items-center flex-wrap gap-2'>
|
|
154
|
+
<Button variant='ghost' size='sm'>
|
|
155
|
+
Small
|
|
156
|
+
</Button>
|
|
157
|
+
<Button variant='ghost'>Default</Button>
|
|
158
|
+
<Button variant='ghost' size='lg'>
|
|
159
|
+
Large
|
|
160
|
+
</Button>
|
|
161
|
+
<Button variant='ghost' size='icon-sm'>
|
|
162
|
+
<TrashIcon />
|
|
163
|
+
</Button>
|
|
164
|
+
<Button variant='ghost' size='icon'>
|
|
165
|
+
<TrashIcon />
|
|
166
|
+
</Button>
|
|
167
|
+
<Button variant='ghost' size='icon-lg'>
|
|
168
|
+
<TrashIcon />
|
|
169
|
+
</Button>
|
|
170
|
+
<Button variant='ghost' disabled>
|
|
171
|
+
Disabled
|
|
172
|
+
</Button>
|
|
173
|
+
</div>
|
|
174
|
+
)
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Loading
|
|
179
|
+
|
|
180
|
+
```tsx
|
|
181
|
+
import { Button } from '@lglab/compose-ui/button'
|
|
182
|
+
import { LoaderCircle } from 'lucide-react'
|
|
183
|
+
import { useState } from 'react'
|
|
184
|
+
|
|
185
|
+
export default function LoadingExample() {
|
|
186
|
+
const [loading, setLoading] = useState(false)
|
|
187
|
+
|
|
188
|
+
const handleClick = () => {
|
|
189
|
+
setLoading(true)
|
|
190
|
+
setTimeout(() => {
|
|
191
|
+
setLoading(false)
|
|
192
|
+
}, 2000)
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
return (
|
|
196
|
+
<div className='flex gap-2'>
|
|
197
|
+
<Button disabled={loading} focusableWhenDisabled onClick={handleClick}>
|
|
198
|
+
{loading ? (
|
|
199
|
+
<div className='flex items-center gap-2'>
|
|
200
|
+
<LoaderCircle className='animate-spin' /> Loading...
|
|
201
|
+
</div>
|
|
202
|
+
) : (
|
|
203
|
+
'Submit'
|
|
204
|
+
)}
|
|
205
|
+
</Button>
|
|
206
|
+
</div>
|
|
207
|
+
)
|
|
208
|
+
}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### As Link
|
|
212
|
+
|
|
213
|
+
```tsx
|
|
214
|
+
import { Button } from '@lglab/compose-ui/button'
|
|
215
|
+
import { Github } from 'lucide-react'
|
|
216
|
+
import Link from 'next/link'
|
|
217
|
+
|
|
218
|
+
export default function AsLinkExample() {
|
|
219
|
+
return (
|
|
220
|
+
<div className='flex gap-2'>
|
|
221
|
+
<Button
|
|
222
|
+
render={
|
|
223
|
+
<Link href='https://github.com/LGLabGreg/compose-ui'>
|
|
224
|
+
<Github />
|
|
225
|
+
Github
|
|
226
|
+
</Link>
|
|
227
|
+
}
|
|
228
|
+
nativeButton={false}
|
|
229
|
+
/>
|
|
230
|
+
</div>
|
|
231
|
+
)
|
|
232
|
+
}
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
## Resources
|
|
236
|
+
|
|
237
|
+
- [Base UI Button Documentation](https://base-ui.com/react/components/button)
|
|
238
|
+
- [API Reference](https://base-ui.com/react/components/button#api-reference)
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
# Card
|
|
2
|
+
|
|
3
|
+
A flexible card component with support for media, headers, content sections, and footers. Supports both vertical and horizontal layouts with multiple variants.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @lglab/compose-ui
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Import
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { CardRoot, CardMedia, CardHeader, CardTitle, CardDescription, CardContent, CardSection, CardFooter } from '@lglab/compose-ui'
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Examples
|
|
18
|
+
|
|
19
|
+
### Basic
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
import { Button } from '@lglab/compose-ui/button'
|
|
23
|
+
import {
|
|
24
|
+
CardDescription,
|
|
25
|
+
CardFooter,
|
|
26
|
+
CardHeader,
|
|
27
|
+
CardMedia,
|
|
28
|
+
CardRoot,
|
|
29
|
+
CardTitle,
|
|
30
|
+
} from '@lglab/compose-ui/card'
|
|
31
|
+
|
|
32
|
+
export default function VerticalMediaCard() {
|
|
33
|
+
return (
|
|
34
|
+
<CardRoot className='w-80 max-w-full'>
|
|
35
|
+
<CardMedia className='aspect-video rounded-t-lg'>
|
|
36
|
+
<img
|
|
37
|
+
src='https://images.unsplash.com/photo-1523275335684-37898b6baf30?q=80'
|
|
38
|
+
alt='Product displayed on a desk with notebook and fruit'
|
|
39
|
+
/>
|
|
40
|
+
</CardMedia>
|
|
41
|
+
<CardHeader>
|
|
42
|
+
<CardTitle>Product Name</CardTitle>
|
|
43
|
+
<CardDescription>This is a description of the product.</CardDescription>
|
|
44
|
+
</CardHeader>
|
|
45
|
+
<CardFooter className='justify-end gap-2'>
|
|
46
|
+
<Button size='sm' variant='outline'>
|
|
47
|
+
Details
|
|
48
|
+
</Button>
|
|
49
|
+
<Button size='sm'>Add to Cart</Button>
|
|
50
|
+
</CardFooter>
|
|
51
|
+
</CardRoot>
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Horizontal Layout
|
|
57
|
+
|
|
58
|
+
```tsx
|
|
59
|
+
import { Button } from '@lglab/compose-ui/button'
|
|
60
|
+
import {
|
|
61
|
+
CardDescription,
|
|
62
|
+
CardFooter,
|
|
63
|
+
CardHeader,
|
|
64
|
+
CardMedia,
|
|
65
|
+
CardRoot,
|
|
66
|
+
CardTitle,
|
|
67
|
+
} from '@lglab/compose-ui/card'
|
|
68
|
+
|
|
69
|
+
export default function HorizontalLayoutCard() {
|
|
70
|
+
return (
|
|
71
|
+
<CardRoot className='w-fit flex flex-row'>
|
|
72
|
+
<CardMedia className='w-30 rounded-l-lg'>
|
|
73
|
+
<img
|
|
74
|
+
src='https://images.unsplash.com/photo-1632765854612-9b02b6ec2b15?q=80'
|
|
75
|
+
alt='Grid of user avatars'
|
|
76
|
+
className='aspect-square'
|
|
77
|
+
/>
|
|
78
|
+
</CardMedia>
|
|
79
|
+
<div className='flex flex-1 flex-col'>
|
|
80
|
+
<CardHeader>
|
|
81
|
+
<CardTitle>User Profile</CardTitle>
|
|
82
|
+
<CardDescription>
|
|
83
|
+
Member since 2024. Active contributor to the community.
|
|
84
|
+
</CardDescription>
|
|
85
|
+
</CardHeader>
|
|
86
|
+
<CardFooter className='gap-2'>
|
|
87
|
+
<Button size='sm'>Follow</Button>
|
|
88
|
+
<Button size='sm' variant='outline'>
|
|
89
|
+
Message
|
|
90
|
+
</Button>
|
|
91
|
+
</CardFooter>
|
|
92
|
+
</div>
|
|
93
|
+
</CardRoot>
|
|
94
|
+
)
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Split Layout
|
|
99
|
+
|
|
100
|
+
```tsx
|
|
101
|
+
import { Button } from '@lglab/compose-ui/button'
|
|
102
|
+
import { CardDescription, CardMedia, CardRoot, CardTitle } from '@lglab/compose-ui/card'
|
|
103
|
+
|
|
104
|
+
export default function SplitLayoutCard() {
|
|
105
|
+
return (
|
|
106
|
+
<CardRoot className='max-w-lg overflow-hidden flex flex-col md:flex-row'>
|
|
107
|
+
<CardMedia className='aspect-video md:w-1/2 shrink-0'>
|
|
108
|
+
<img
|
|
109
|
+
src='https://images.unsplash.com/photo-1513185041617-8ab03f83d6c5?q=80'
|
|
110
|
+
alt='Open book on a wooden table'
|
|
111
|
+
className='h-full object-cover'
|
|
112
|
+
/>
|
|
113
|
+
</CardMedia>
|
|
114
|
+
<div className='flex flex-1 flex-col justify-center p-6'>
|
|
115
|
+
<CardTitle as='h2' className='text-xl text-primary'>
|
|
116
|
+
Article Title
|
|
117
|
+
</CardTitle>
|
|
118
|
+
<CardDescription className='mt-2'>
|
|
119
|
+
This is a longer description that provides context about the article content.
|
|
120
|
+
Perfect for blog posts or news items.
|
|
121
|
+
</CardDescription>
|
|
122
|
+
<div className='mt-4 flex gap-2'>
|
|
123
|
+
<Button size='sm'>Read Article</Button>
|
|
124
|
+
<Button size='sm' variant='ghost'>
|
|
125
|
+
Share
|
|
126
|
+
</Button>
|
|
127
|
+
</div>
|
|
128
|
+
</div>
|
|
129
|
+
</CardRoot>
|
|
130
|
+
)
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Grid Stats
|
|
135
|
+
|
|
136
|
+
```tsx
|
|
137
|
+
import { CardContent, CardHeader, CardRoot, CardTitle } from '@lglab/compose-ui/card'
|
|
138
|
+
|
|
139
|
+
export default function GridStatsCard() {
|
|
140
|
+
const stats = [
|
|
141
|
+
{ label: 'Total Sales', value: '$12,345' },
|
|
142
|
+
{ label: 'Orders', value: '234' },
|
|
143
|
+
{ label: 'Customers', value: '1,234' },
|
|
144
|
+
{ label: 'Revenue', value: '$45,678' },
|
|
145
|
+
]
|
|
146
|
+
|
|
147
|
+
return (
|
|
148
|
+
<CardRoot className='w-full md:w-2/3 lg:w-1/2'>
|
|
149
|
+
<CardHeader>
|
|
150
|
+
<CardTitle>Dashboard Overview</CardTitle>
|
|
151
|
+
</CardHeader>
|
|
152
|
+
<CardContent>
|
|
153
|
+
<div className='grid grid-cols-2 gap-4'>
|
|
154
|
+
{stats.map((stat) => (
|
|
155
|
+
<div key={stat.label}>
|
|
156
|
+
<p className='text-sm text-muted-foreground'>{stat.label}</p>
|
|
157
|
+
<p className='text-lg font-semibold'>{stat.value}</p>
|
|
158
|
+
</div>
|
|
159
|
+
))}
|
|
160
|
+
</div>
|
|
161
|
+
</CardContent>
|
|
162
|
+
</CardRoot>
|
|
163
|
+
)
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### Multi-Section
|
|
168
|
+
|
|
169
|
+
```tsx
|
|
170
|
+
import { Button } from '@lglab/compose-ui/button'
|
|
171
|
+
import {
|
|
172
|
+
CardDescription,
|
|
173
|
+
CardFooter,
|
|
174
|
+
CardRoot,
|
|
175
|
+
CardSection,
|
|
176
|
+
CardTitle,
|
|
177
|
+
} from '@lglab/compose-ui/card'
|
|
178
|
+
import { Separator } from '@lglab/compose-ui/separator'
|
|
179
|
+
|
|
180
|
+
export default function MultiSectionCard() {
|
|
181
|
+
return (
|
|
182
|
+
<CardRoot className='w-96 max-w-full'>
|
|
183
|
+
<CardSection className='space-y-0.5'>
|
|
184
|
+
<CardTitle>Event Details</CardTitle>
|
|
185
|
+
<CardDescription>Annual Company Meetup</CardDescription>
|
|
186
|
+
</CardSection>
|
|
187
|
+
|
|
188
|
+
<Separator />
|
|
189
|
+
|
|
190
|
+
<CardSection>
|
|
191
|
+
<dl className='space-y-3'>
|
|
192
|
+
<div>
|
|
193
|
+
<dt className='text-sm font-semibold'>Date:</dt>
|
|
194
|
+
<dd className='text-sm'>March 15, 2024</dd>
|
|
195
|
+
</div>
|
|
196
|
+
<div>
|
|
197
|
+
<dt className='text-sm font-semibold'>Location:</dt>
|
|
198
|
+
<dd className='text-sm'>San Francisco, CA</dd>
|
|
199
|
+
</div>
|
|
200
|
+
<div>
|
|
201
|
+
<dt className='text-sm font-semibold'>Attendees:</dt>
|
|
202
|
+
<dd className='text-sm'>150 people</dd>
|
|
203
|
+
</div>
|
|
204
|
+
</dl>
|
|
205
|
+
</CardSection>
|
|
206
|
+
|
|
207
|
+
<Separator />
|
|
208
|
+
|
|
209
|
+
<CardFooter className='gap-2'>
|
|
210
|
+
<Button size='sm'>Register</Button>
|
|
211
|
+
<Button size='sm' variant='outline'>
|
|
212
|
+
Learn More
|
|
213
|
+
</Button>
|
|
214
|
+
</CardFooter>
|
|
215
|
+
</CardRoot>
|
|
216
|
+
)
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### Custom Heading Level
|
|
221
|
+
|
|
222
|
+
```tsx
|
|
223
|
+
import { CardDescription, CardHeader, CardRoot, CardTitle } from '@lglab/compose-ui/card'
|
|
224
|
+
|
|
225
|
+
export default function CardWithCustomHeading() {
|
|
226
|
+
return (
|
|
227
|
+
<CardRoot className='w-72'>
|
|
228
|
+
<CardHeader>
|
|
229
|
+
<CardTitle as='h2' className='text-xl'>
|
|
230
|
+
Page Title Card
|
|
231
|
+
</CardTitle>
|
|
232
|
+
<CardDescription>Using h2 instead of the default h3.</CardDescription>
|
|
233
|
+
</CardHeader>
|
|
234
|
+
</CardRoot>
|
|
235
|
+
)
|
|
236
|
+
}
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### Variants
|
|
240
|
+
|
|
241
|
+
```tsx
|
|
242
|
+
import { CardRoot, CardTitle } from '@lglab/compose-ui/card'
|
|
243
|
+
|
|
244
|
+
export default function CardVariants() {
|
|
245
|
+
return (
|
|
246
|
+
<div className='flex gap-4'>
|
|
247
|
+
<CardRoot variant='default' className='w-40 p-4'>
|
|
248
|
+
<CardTitle className='text-sm'>Default</CardTitle>
|
|
249
|
+
</CardRoot>
|
|
250
|
+
<CardRoot variant='outline' className='w-40 p-4'>
|
|
251
|
+
<CardTitle className='text-sm'>Outline</CardTitle>
|
|
252
|
+
</CardRoot>
|
|
253
|
+
<CardRoot variant='elevated' className='w-40 p-4'>
|
|
254
|
+
<CardTitle className='text-sm'>Elevated</CardTitle>
|
|
255
|
+
</CardRoot>
|
|
256
|
+
</div>
|
|
257
|
+
)
|
|
258
|
+
}
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
## Resources
|
|
262
|
+
|
|
263
|
+
- [Base UI Card Documentation](https://base-ui.com/react/components/card)
|
|
264
|
+
- [API Reference](https://base-ui.com/react/components/card#api-reference)
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# Checkbox Group
|
|
2
|
+
|
|
3
|
+
Provides shared state to a series of checkboxes.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @lglab/compose-ui
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Import
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { CheckboxGroupRoot } from '@lglab/compose-ui'
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Examples
|
|
18
|
+
|
|
19
|
+
### Default
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
import { CheckboxIndicator, CheckboxRoot } from '@lglab/compose-ui/checkbox'
|
|
23
|
+
import { CheckboxGroupRoot } from '@lglab/compose-ui/checkbox-group'
|
|
24
|
+
import { Check } from 'lucide-react'
|
|
25
|
+
import * as React from 'react'
|
|
26
|
+
|
|
27
|
+
const apples = [
|
|
28
|
+
{ value: 'fuji', label: 'Fuji' },
|
|
29
|
+
{ value: 'gala', label: 'Gala' },
|
|
30
|
+
{ value: 'granny-smith', label: 'Granny Smith' },
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
export default function DefaultExample() {
|
|
34
|
+
const id = React.useId()
|
|
35
|
+
const [value, setValue] = React.useState<string[]>(['fuji'])
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<CheckboxGroupRoot aria-labelledby={id} value={value} onValueChange={setValue}>
|
|
39
|
+
<div className='text-sm font-medium text-foreground' id={id}>
|
|
40
|
+
Favorite apples
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
{apples.map((apple) => (
|
|
44
|
+
<label key={apple.value} className='flex items-center gap-2 text-sm'>
|
|
45
|
+
<CheckboxRoot name='apple' value={apple.value}>
|
|
46
|
+
<CheckboxIndicator>
|
|
47
|
+
<Check className='size-3.5' />
|
|
48
|
+
</CheckboxIndicator>
|
|
49
|
+
</CheckboxRoot>
|
|
50
|
+
{apple.label}
|
|
51
|
+
</label>
|
|
52
|
+
))}
|
|
53
|
+
</CheckboxGroupRoot>
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Parent Checkbox
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
import { CheckboxIndicator, CheckboxRoot } from '@lglab/compose-ui/checkbox'
|
|
62
|
+
import { CheckboxGroupRoot } from '@lglab/compose-ui/checkbox-group'
|
|
63
|
+
import { Check, Minus } from 'lucide-react'
|
|
64
|
+
import * as React from 'react'
|
|
65
|
+
|
|
66
|
+
const apples = [
|
|
67
|
+
{ value: 'fuji', label: 'Fuji' },
|
|
68
|
+
{ value: 'gala', label: 'Gala' },
|
|
69
|
+
{ value: 'granny-smith', label: 'Granny Smith' },
|
|
70
|
+
]
|
|
71
|
+
|
|
72
|
+
export default function ParentCheckboxExample() {
|
|
73
|
+
const id = React.useId()
|
|
74
|
+
const [value, setValue] = React.useState<string[]>(['fuji'])
|
|
75
|
+
|
|
76
|
+
return (
|
|
77
|
+
<CheckboxGroupRoot
|
|
78
|
+
aria-labelledby={id}
|
|
79
|
+
value={value}
|
|
80
|
+
onValueChange={setValue}
|
|
81
|
+
allValues={apples.map((apple) => apple.value)}
|
|
82
|
+
className='pl-4'
|
|
83
|
+
>
|
|
84
|
+
<label className='-ml-4 flex items-center gap-2 text-sm font-medium' id={id}>
|
|
85
|
+
<CheckboxRoot name='apples' parent>
|
|
86
|
+
<CheckboxIndicator
|
|
87
|
+
render={(props, state) => (
|
|
88
|
+
<span {...props}>
|
|
89
|
+
{state.indeterminate ? (
|
|
90
|
+
<Minus className='size-3.5' />
|
|
91
|
+
) : (
|
|
92
|
+
<Check className='size-3.5' />
|
|
93
|
+
)}
|
|
94
|
+
</span>
|
|
95
|
+
)}
|
|
96
|
+
/>
|
|
97
|
+
</CheckboxRoot>
|
|
98
|
+
Apples
|
|
99
|
+
</label>
|
|
100
|
+
|
|
101
|
+
{apples.map((apple) => (
|
|
102
|
+
<label key={apple.value} className='flex items-center gap-2 text-sm'>
|
|
103
|
+
<CheckboxRoot value={apple.value}>
|
|
104
|
+
<CheckboxIndicator>
|
|
105
|
+
<Check className='size-3.5' />
|
|
106
|
+
</CheckboxIndicator>
|
|
107
|
+
</CheckboxRoot>
|
|
108
|
+
{apple.label}
|
|
109
|
+
</label>
|
|
110
|
+
))}
|
|
111
|
+
</CheckboxGroupRoot>
|
|
112
|
+
)
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### With Field
|
|
117
|
+
|
|
118
|
+
```tsx
|
|
119
|
+
import { CheckboxIndicator, CheckboxRoot } from '@lglab/compose-ui/checkbox'
|
|
120
|
+
import { CheckboxGroupRoot } from '@lglab/compose-ui/checkbox-group'
|
|
121
|
+
import { FieldDescription, FieldItem, FieldLabel, FieldRoot } from '@lglab/compose-ui/field'
|
|
122
|
+
import { FieldsetLegend, FieldsetRoot } from '@lglab/compose-ui/fieldset'
|
|
123
|
+
import { Check } from 'lucide-react'
|
|
124
|
+
|
|
125
|
+
const fruits = [
|
|
126
|
+
{ value: 'apple', label: 'Apple' },
|
|
127
|
+
{ value: 'banana', label: 'Banana' },
|
|
128
|
+
{ value: 'orange', label: 'Orange' },
|
|
129
|
+
]
|
|
130
|
+
|
|
131
|
+
export default function WithFieldExample() {
|
|
132
|
+
return (
|
|
133
|
+
<FieldRoot name='fruits'>
|
|
134
|
+
<FieldsetRoot render={<CheckboxGroupRoot />}>
|
|
135
|
+
<FieldsetLegend>Favorite Fruits</FieldsetLegend>
|
|
136
|
+
{fruits.map((fruit) => (
|
|
137
|
+
<FieldItem key={fruit.value}>
|
|
138
|
+
<FieldLabel>
|
|
139
|
+
<CheckboxRoot value={fruit.value}>
|
|
140
|
+
<CheckboxIndicator>
|
|
141
|
+
<Check className='size-3.5' />
|
|
142
|
+
</CheckboxIndicator>
|
|
143
|
+
</CheckboxRoot>
|
|
144
|
+
{fruit.label}
|
|
145
|
+
</FieldLabel>
|
|
146
|
+
</FieldItem>
|
|
147
|
+
))}
|
|
148
|
+
</FieldsetRoot>
|
|
149
|
+
<FieldDescription>Select your favorite fruits.</FieldDescription>
|
|
150
|
+
</FieldRoot>
|
|
151
|
+
)
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Resources
|
|
156
|
+
|
|
157
|
+
- [Base UI Checkbox Group Documentation](https://base-ui.com/react/components/checkbox-group)
|
|
158
|
+
- [API Reference](https://base-ui.com/react/components/checkbox-group#api-reference)
|