alope-ui 1.0.6
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 +1661 -0
- package/dist/components/Accordion/Accordion.d.ts +18 -0
- package/dist/components/Alert/Alert.d.ts +34 -0
- package/dist/components/Badge/Badge.d.ts +25 -0
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +16 -0
- package/dist/components/Button/Button.d.ts +67 -0
- package/dist/components/Card/Card.d.ts +19 -0
- package/dist/components/CheckboxInput/CheckboxInput.d.ts +10 -0
- package/dist/components/CheckboxInput/ListCheckboxInput.d.ts +55 -0
- package/dist/components/Modal/Modal.d.ts +13 -0
- package/dist/components/Offcanvas/Offcanvas.d.ts +14 -0
- package/dist/components/RadioInput/RadioInput.d.ts +55 -0
- package/dist/components/SelectInput/SelectInput.d.ts +14 -0
- package/dist/components/TextInput/TextInput.d.ts +6 -0
- package/dist/components/Toast/Toast.d.ts +28 -0
- package/dist/components/Toast/ToastProvider.d.ts +11 -0
- package/dist/components/index.d.ts +13 -0
- package/dist/index.css +1 -0
- package/dist/main.cjs +671 -0
- package/dist/main.d.ts +14 -0
- package/package.json +64 -0
package/README.md
ADDED
|
@@ -0,0 +1,1661 @@
|
|
|
1
|
+
# ALOPE UI Library
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/alope-ui-v3)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
[](https://reactjs.org/)
|
|
6
|
+
|
|
7
|
+
**ALOPE UI Library** is a modern React-based User Interface (UI) component library designed to accelerate your web development workflow. It provides a comprehensive collection of flexible, accessible, and beautifully designed components that ensure consistent user experiences across your applications.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 🌟 Why Choose ALOPE UI?
|
|
12
|
+
|
|
13
|
+
- **🎨 Customizable** - Easy theming and styling with Tailwind CSS
|
|
14
|
+
- **⚡ Lightweight** - Tree-shakable components for optimal bundle size
|
|
15
|
+
- **📖 Well Documented** - Comprehensive documentation with live examples
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 📦 Key Features
|
|
20
|
+
|
|
21
|
+
- 🔧 **Flexible Customization** - Customize via props and Tailwind classes
|
|
22
|
+
- 📘 **Developer Friendly** - TypeScript support and IntelliSense
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## 🚀 Quick Start
|
|
27
|
+
|
|
28
|
+
### Installation
|
|
29
|
+
|
|
30
|
+
**Using npm:**
|
|
31
|
+
```bash
|
|
32
|
+
npm install alope-ui-v3
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**Add ``@import`` directive(s) on your main css file:**
|
|
36
|
+
```css
|
|
37
|
+
/* index.css */
|
|
38
|
+
|
|
39
|
+
/* Make sure to import TailwindCSS first */
|
|
40
|
+
@import "tailwindcss";
|
|
41
|
+
|
|
42
|
+
/* Then import the styles from Alope UI */
|
|
43
|
+
@import "../node_modules/alope-ui-v3/dist/index.css";
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Basic Setup
|
|
47
|
+
|
|
48
|
+
Import and use any component in your React application:
|
|
49
|
+
|
|
50
|
+
```jsx
|
|
51
|
+
import React from 'react';
|
|
52
|
+
import { Button } from 'alope-ui-v3';
|
|
53
|
+
|
|
54
|
+
function App() {
|
|
55
|
+
return (
|
|
56
|
+
<div className="App">
|
|
57
|
+
<Button variant="solid" variantType="primary">
|
|
58
|
+
Hello ALOPE UI!
|
|
59
|
+
</Button>
|
|
60
|
+
</div>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export default App;
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### ⚠️ IMPORTANT NOTES:
|
|
68
|
+
|
|
69
|
+
If you're using the ``to`` prop on a ``Button`` (or any other component that uses SPA-style navigation), make sure you have a ``react-router-dom`` properly configured.
|
|
70
|
+
Refer to the [official documentation](https://reactrouter.com/start/declarative/installation) for setup instructions if needed.
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
```jsx
|
|
74
|
+
import React from 'react';
|
|
75
|
+
import { Button } from 'alope-ui-v3';
|
|
76
|
+
|
|
77
|
+
function App() {
|
|
78
|
+
return (
|
|
79
|
+
<div className="App">
|
|
80
|
+
<Button to='/button' variant="solid" variantType="primary">
|
|
81
|
+
Hello I'm going to Button Page!
|
|
82
|
+
</Button>
|
|
83
|
+
</div>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export default App;
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## 🧩 Component Library
|
|
93
|
+
|
|
94
|
+
### Navigation Components
|
|
95
|
+
- [🪗 Accordion](#accordion) - Collapsible content panels
|
|
96
|
+
- [🍞 Breadcrumb](#breadcrumb) - Navigation trail
|
|
97
|
+
|
|
98
|
+
### Feedback Components
|
|
99
|
+
- [⚠️ Alert](#alert) - Status messages and notifications
|
|
100
|
+
- [🍞 Toast](#toast) - Temporary notification messages
|
|
101
|
+
|
|
102
|
+
### Data Display
|
|
103
|
+
- [🏷️ Badge](#badge) - Status indicators and labels
|
|
104
|
+
- [🃏 Card](#card) - Content containers
|
|
105
|
+
|
|
106
|
+
### Form Controls
|
|
107
|
+
- [☑️ Checkbox Input](#checkbox-input) - Multiple choice selections
|
|
108
|
+
- [🔘 Radio Input](#radio-input) - Single choice selections
|
|
109
|
+
- [📝 Select Input](#select-input) - Dropdown selections
|
|
110
|
+
- [⌨️ Text Input](#text-input) - Text input fields
|
|
111
|
+
|
|
112
|
+
### Interactive Elements
|
|
113
|
+
- [🔘 Button](#button) - Clickable actions
|
|
114
|
+
- [🪟 Modal](#modal) - Dialog boxes and overlays
|
|
115
|
+
- [📱 Offcanvas](#offcanvas) - Side panels and drawers
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## 📖 Component Documentation
|
|
120
|
+
|
|
121
|
+
## Accordion
|
|
122
|
+
|
|
123
|
+
The Accordion component allows users to show and hide sections of related content on a page.
|
|
124
|
+
|
|
125
|
+
### Import
|
|
126
|
+
|
|
127
|
+
```jsx
|
|
128
|
+
import { Accordion } from "alope-ui-v3";
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Props
|
|
132
|
+
|
|
133
|
+
| Prop | Type | Default | Description |
|
|
134
|
+
|------|------|---------|-------------|
|
|
135
|
+
| `data` | `AccordionItem[]` | `[]` | Array of accordion items |
|
|
136
|
+
| `single` | `boolean` | `true` | Allow only one panel open at a time |
|
|
137
|
+
| `openIndex` | `number \| number[]` | `undefined` | Controlled open state |
|
|
138
|
+
| `onToggleItem` | `function` | `undefined` | Callback when item is toggled |
|
|
139
|
+
| `icon` | `function` | `undefined` | Custom icon renderer |
|
|
140
|
+
| `labelClassName` | `string` | `""` | Custom CSS class for labels |
|
|
141
|
+
| `labelContainerClassName` | `string` | `""` | Custom CSS class for label containers |
|
|
142
|
+
| `descriptionClassName` | `string` | `""` | Custom CSS class for descriptions |
|
|
143
|
+
|
|
144
|
+
### Basic Usage
|
|
145
|
+
|
|
146
|
+
```jsx
|
|
147
|
+
const accordionData = [
|
|
148
|
+
{
|
|
149
|
+
label: "What is ALOPE UI?",
|
|
150
|
+
description: "ALOPE UI is a modern React component library that helps you build beautiful user interfaces quickly."
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
label: "How do I install it?",
|
|
154
|
+
description: "You can install ALOPE UI using npm, yarn, or pnpm. Check the installation section for details."
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
label: "Is it free to use?",
|
|
158
|
+
description: "Yes! ALOPE UI is completely free and open-source under the MIT license."
|
|
159
|
+
},
|
|
160
|
+
];
|
|
161
|
+
|
|
162
|
+
<Accordion data={accordionData} />
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Single Panel Mode
|
|
166
|
+
|
|
167
|
+
Only allows one panel to be open at a time:
|
|
168
|
+
|
|
169
|
+
```jsx
|
|
170
|
+
<Accordion single data={accordionData} />
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Multiple Panels Mode
|
|
174
|
+
|
|
175
|
+
Allows multiple panels to be open simultaneously:
|
|
176
|
+
|
|
177
|
+
```jsx
|
|
178
|
+
<Accordion single={false} data={accordionData} />
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Custom Styling
|
|
182
|
+
|
|
183
|
+
```jsx
|
|
184
|
+
<Accordion
|
|
185
|
+
data={accordionData}
|
|
186
|
+
labelClassName="font-bold text-lg"
|
|
187
|
+
labelContainerClassName="bg-blue-50 border-blue-200 hover:bg-blue-100"
|
|
188
|
+
descriptionClassName="bg-blue-25 text-gray-700"
|
|
189
|
+
/>
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Controlled State with Custom Icon
|
|
193
|
+
|
|
194
|
+
```jsx
|
|
195
|
+
const [openIndex, setOpenIndex] = useState(0);
|
|
196
|
+
|
|
197
|
+
<Accordion
|
|
198
|
+
data={accordionData}
|
|
199
|
+
openIndex={openIndex}
|
|
200
|
+
onToggleItem={(index) => setOpenIndex(index)}
|
|
201
|
+
icon={isActive => (
|
|
202
|
+
<svg
|
|
203
|
+
className={`w-5 h-5 transition-transform duration-300 ${
|
|
204
|
+
isActive ? 'rotate-180' : 'rotate-0'
|
|
205
|
+
}`}
|
|
206
|
+
fill="none"
|
|
207
|
+
stroke="currentColor"
|
|
208
|
+
viewBox="0 0 24 24"
|
|
209
|
+
>
|
|
210
|
+
<path
|
|
211
|
+
strokeLinecap="round"
|
|
212
|
+
strokeLinejoin="round"
|
|
213
|
+
strokeWidth="2"
|
|
214
|
+
d="M19 9l-7 7-7-7"
|
|
215
|
+
/>
|
|
216
|
+
</svg>
|
|
217
|
+
)}
|
|
218
|
+
/>
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## Alert
|
|
224
|
+
|
|
225
|
+
The Alert component displays important messages to users with different severity levels.
|
|
226
|
+
|
|
227
|
+
### Import
|
|
228
|
+
|
|
229
|
+
```jsx
|
|
230
|
+
import { Alert } from "alope-ui-v3";
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### Props
|
|
234
|
+
|
|
235
|
+
| Prop | Type | Default | Description |
|
|
236
|
+
|------|------|---------|-------------|
|
|
237
|
+
| `type` | `'success' \| 'info' \| 'warning' \| 'error'` | `'info'` | Alert severity type |
|
|
238
|
+
| `title` | `string` | `""` | Alert title |
|
|
239
|
+
| `description` | `string` | `""` | Alert description |
|
|
240
|
+
| `icon` | `ReactNode` | `undefined` | Custom icon |
|
|
241
|
+
| `action` | `ReactNode` | `undefined` | Action button or element |
|
|
242
|
+
| `withClose` | `boolean` | `false` | Show close button |
|
|
243
|
+
| `onClose` | `function` | `undefined` | Close callback |
|
|
244
|
+
|
|
245
|
+
### Basic Usage
|
|
246
|
+
|
|
247
|
+
```jsx
|
|
248
|
+
<Alert
|
|
249
|
+
title="Welcome!"
|
|
250
|
+
description="Thanks for choosing ALOPE UI for your project."
|
|
251
|
+
/>
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### Alert Types
|
|
255
|
+
|
|
256
|
+
```jsx
|
|
257
|
+
{/* Success Alert */}
|
|
258
|
+
<Alert
|
|
259
|
+
type="success"
|
|
260
|
+
title="Success!"
|
|
261
|
+
description="Your changes have been saved successfully."
|
|
262
|
+
/>
|
|
263
|
+
|
|
264
|
+
{/* Info Alert */}
|
|
265
|
+
<Alert
|
|
266
|
+
type="info"
|
|
267
|
+
title="Information"
|
|
268
|
+
description="Here's some helpful information for you."
|
|
269
|
+
/>
|
|
270
|
+
|
|
271
|
+
{/* Warning Alert */}
|
|
272
|
+
<Alert
|
|
273
|
+
type="warning"
|
|
274
|
+
title="Warning"
|
|
275
|
+
description="Please review your input before proceeding."
|
|
276
|
+
/>
|
|
277
|
+
|
|
278
|
+
{/* Error Alert */}
|
|
279
|
+
<Alert
|
|
280
|
+
type="error"
|
|
281
|
+
title="Error"
|
|
282
|
+
description="Something went wrong. Please try again."
|
|
283
|
+
/>
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### Alert with Custom Icon
|
|
287
|
+
|
|
288
|
+
```jsx
|
|
289
|
+
<Alert
|
|
290
|
+
type="warning"
|
|
291
|
+
title="Important Notice"
|
|
292
|
+
description="This action cannot be undone."
|
|
293
|
+
icon={
|
|
294
|
+
<svg className="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
295
|
+
<path
|
|
296
|
+
strokeLinecap="round"
|
|
297
|
+
strokeLinejoin="round"
|
|
298
|
+
strokeWidth={2}
|
|
299
|
+
d="M12 9v2m0 4h.01M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"
|
|
300
|
+
/>
|
|
301
|
+
</svg>
|
|
302
|
+
}
|
|
303
|
+
/>
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
### Alert with Action Button
|
|
307
|
+
|
|
308
|
+
```jsx
|
|
309
|
+
<Alert
|
|
310
|
+
type="info"
|
|
311
|
+
title="Update Available"
|
|
312
|
+
description="A new version of the application is available."
|
|
313
|
+
action={
|
|
314
|
+
<Button size="sm" variantType="info">
|
|
315
|
+
Update Now
|
|
316
|
+
</Button>
|
|
317
|
+
}
|
|
318
|
+
/>
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
### Dismissible Alert
|
|
322
|
+
|
|
323
|
+
```jsx
|
|
324
|
+
<Alert
|
|
325
|
+
withClose
|
|
326
|
+
type="success"
|
|
327
|
+
title="Success!"
|
|
328
|
+
description="Your profile has been updated successfully."
|
|
329
|
+
onClose={() => console.log('Alert closed')}
|
|
330
|
+
/>
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
---
|
|
334
|
+
|
|
335
|
+
## Badge
|
|
336
|
+
|
|
337
|
+
The Badge component is used to display small pieces of information like status, count, or labels.
|
|
338
|
+
|
|
339
|
+
### Import
|
|
340
|
+
|
|
341
|
+
```jsx
|
|
342
|
+
import { Badge } from "alope-ui-v3";
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
### Props
|
|
346
|
+
|
|
347
|
+
| Prop | Type | Default | Description |
|
|
348
|
+
|------|------|---------|-------------|
|
|
349
|
+
| `variant` | `'default' \| 'success' \| 'info' \| 'warning' \| 'error'` | `'default'` | Badge color variant |
|
|
350
|
+
| `children` | `ReactNode` | `undefined` | Badge content |
|
|
351
|
+
| `isAbsolute` | `boolean` | `false` | Absolute positioning |
|
|
352
|
+
| `position` | `'top-right' \| 'top-left' \| 'bottom-right' \| 'bottom-left'` | `'top-right'` | Position when absolute |
|
|
353
|
+
| `icon` | `ReactNode` | `undefined` | Custom icon |
|
|
354
|
+
|
|
355
|
+
### Basic Variants
|
|
356
|
+
|
|
357
|
+
```jsx
|
|
358
|
+
<div className="flex flex-wrap gap-2">
|
|
359
|
+
<Badge variant="default">Default</Badge>
|
|
360
|
+
<Badge variant="success">Success</Badge>
|
|
361
|
+
<Badge variant="info">Info</Badge>
|
|
362
|
+
<Badge variant="warning">Warning</Badge>
|
|
363
|
+
<Badge variant="error">Error</Badge>
|
|
364
|
+
</div>
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
### Badge with Icon
|
|
368
|
+
|
|
369
|
+
```jsx
|
|
370
|
+
<Badge variant="success" icon={<CheckIcon className="w-4 h-4" />}>
|
|
371
|
+
Verified
|
|
372
|
+
</Badge>
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
### Absolute Positioning
|
|
376
|
+
|
|
377
|
+
Perfect for notification indicators or status markers:
|
|
378
|
+
|
|
379
|
+
```jsx
|
|
380
|
+
<div className="relative inline-block">
|
|
381
|
+
<Button>
|
|
382
|
+
Messages
|
|
383
|
+
</Button>
|
|
384
|
+
<Badge
|
|
385
|
+
variant="error"
|
|
386
|
+
position="top-right"
|
|
387
|
+
isAbsolute
|
|
388
|
+
>
|
|
389
|
+
3
|
|
390
|
+
</Badge>
|
|
391
|
+
</div>
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
### All Position Examples
|
|
395
|
+
|
|
396
|
+
```jsx
|
|
397
|
+
<div className="grid grid-cols-2 gap-4 w-fit">
|
|
398
|
+
<Card containerClassName="relative p-8">
|
|
399
|
+
<Badge variant="success" position="top-left" isAbsolute>1</Badge>
|
|
400
|
+
<span>Top Left</span>
|
|
401
|
+
</Card>
|
|
402
|
+
|
|
403
|
+
<Card containerClassName="relative p-8">
|
|
404
|
+
<Badge variant="info" position="top-right" isAbsolute>2</Badge>
|
|
405
|
+
<span>Top Right</span>
|
|
406
|
+
</Card>
|
|
407
|
+
|
|
408
|
+
<Card containerClassName="relative p-8">
|
|
409
|
+
<Badge variant="warning" position="bottom-left" isAbsolute>3</Badge>
|
|
410
|
+
<span>Bottom Left</span>
|
|
411
|
+
</Card>
|
|
412
|
+
|
|
413
|
+
<Card containerClassName="relative p-8">
|
|
414
|
+
<Badge variant="error" position="bottom-right" isAbsolute>4</Badge>
|
|
415
|
+
<span>Bottom Right</span>
|
|
416
|
+
</Card>
|
|
417
|
+
</div>
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
---
|
|
421
|
+
|
|
422
|
+
## Breadcrumb
|
|
423
|
+
|
|
424
|
+
The Breadcrumb component provides navigation context showing the user's location within the application hierarchy.
|
|
425
|
+
|
|
426
|
+
### Import
|
|
427
|
+
|
|
428
|
+
```jsx
|
|
429
|
+
import { Breadcrumb } from "alope-ui-v3";
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
### Props
|
|
433
|
+
|
|
434
|
+
| Prop | Type | Default | Description |
|
|
435
|
+
|------|------|---------|-------------|
|
|
436
|
+
| `data` | `BreadcrumbItem[]` | `[]` | Array of breadcrumb items |
|
|
437
|
+
| `separator` | `ReactNode` | `"/"` | Custom separator between items |
|
|
438
|
+
| `linkClassName` | `string` | `""` | Custom CSS class for links |
|
|
439
|
+
|
|
440
|
+
### Basic Usage
|
|
441
|
+
|
|
442
|
+
```jsx
|
|
443
|
+
const breadcrumbData = [
|
|
444
|
+
{ label: 'Home', path: '/' },
|
|
445
|
+
{ label: 'Products', path: '/products' },
|
|
446
|
+
{ label: 'Laptops', path: '/products/laptops' },
|
|
447
|
+
{ label: 'MacBook Pro' } // Current page (no path)
|
|
448
|
+
];
|
|
449
|
+
|
|
450
|
+
<Breadcrumb data={breadcrumbData} />
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
### Custom Separator
|
|
454
|
+
|
|
455
|
+
```jsx
|
|
456
|
+
<Breadcrumb
|
|
457
|
+
data={breadcrumbData}
|
|
458
|
+
separator={
|
|
459
|
+
<svg className="w-4 h-4 mx-2" fill="currentColor" viewBox="0 0 20 20">
|
|
460
|
+
<path d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" />
|
|
461
|
+
</svg>
|
|
462
|
+
}
|
|
463
|
+
/>
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
### Custom Styling
|
|
467
|
+
|
|
468
|
+
```jsx
|
|
469
|
+
<Breadcrumb
|
|
470
|
+
data={breadcrumbData}
|
|
471
|
+
linkClassName="text-blue-600 hover:text-blue-800 font-medium"
|
|
472
|
+
separator={<span className="mx-2 text-gray-400">→</span>}
|
|
473
|
+
/>
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
### Breadcrumb with Icons
|
|
477
|
+
|
|
478
|
+
```jsx
|
|
479
|
+
const breadcrumbWithIcons = [
|
|
480
|
+
{
|
|
481
|
+
label: 'Home',
|
|
482
|
+
path: '/',
|
|
483
|
+
icon: (
|
|
484
|
+
<svg className="w-4 h-4 mr-1" fill="currentColor" viewBox="0 0 20 20">
|
|
485
|
+
<path d="M10.707 2.293a1 1 0 00-1.414 0l-7 7a1 1 0 001.414 1.414L4 10.414V17a1 1 0 001 1h2a1 1 0 001-1v-2a1 1 0 011-1h2a1 1 0 011 1v2a1 1 0 001 1h2a1 1 0 001-1v-6.586l.293.293a1 1 0 001.414-1.414l-7-7z" />
|
|
486
|
+
</svg>
|
|
487
|
+
),
|
|
488
|
+
},
|
|
489
|
+
{
|
|
490
|
+
label: 'Products',
|
|
491
|
+
path: '/products',
|
|
492
|
+
icon: <span className="mr-1">🛍️</span>,
|
|
493
|
+
},
|
|
494
|
+
{
|
|
495
|
+
label: 'MacBook Pro',
|
|
496
|
+
icon: <span className="mr-1">💻</span>,
|
|
497
|
+
},
|
|
498
|
+
];
|
|
499
|
+
|
|
500
|
+
<Breadcrumb data={breadcrumbWithIcons} />
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
---
|
|
504
|
+
|
|
505
|
+
## Button
|
|
506
|
+
|
|
507
|
+
The Button component provides clickable elements for user interactions with various styles and states.
|
|
508
|
+
|
|
509
|
+
### Import
|
|
510
|
+
|
|
511
|
+
```jsx
|
|
512
|
+
import { Button } from "alope-ui-v3";
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
### Props
|
|
516
|
+
|
|
517
|
+
| Prop | Type | Default | Description |
|
|
518
|
+
|------|------|---------|-------------|
|
|
519
|
+
| `variant` | `'solid' \| 'outline' \| 'ghost' \| 'plain'` | `'solid'` | Button style variant |
|
|
520
|
+
| `variantType` | `'primary' \| 'secondary' \| 'success' \| 'info' \| 'warning' \| 'error'` | `'primary'` | Button color theme |
|
|
521
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Button size |
|
|
522
|
+
| `radius` | `'regular' \| 'stadium'` | `'regular'` | Border radius style |
|
|
523
|
+
| `fullWidth` | `boolean` | `false` | Full width button |
|
|
524
|
+
| `disabled` | `boolean` | `false` | Disabled state |
|
|
525
|
+
| `to` | `string` | `undefined` | Link destination |
|
|
526
|
+
| `prefixIcon` | `ReactNode` | `undefined` | Icon before text |
|
|
527
|
+
| `suffixIcon` | `ReactNode` | `undefined` | Icon after text |
|
|
528
|
+
| `onClick` | `function` | `undefined` | Click handler |
|
|
529
|
+
| `children` | `ReactNode` | `undefined` | Button content |
|
|
530
|
+
|
|
531
|
+
### Button Variants
|
|
532
|
+
|
|
533
|
+
```jsx
|
|
534
|
+
<div className="flex flex-wrap gap-2">
|
|
535
|
+
<Button variant="solid">Solid Button</Button>
|
|
536
|
+
<Button variant="outline">Outline Button</Button>
|
|
537
|
+
<Button variant="ghost">Ghost Button</Button>
|
|
538
|
+
<Button variant="plain">Plain Button</Button>
|
|
539
|
+
</div>
|
|
540
|
+
```
|
|
541
|
+
|
|
542
|
+
### Button Types (Colors)
|
|
543
|
+
|
|
544
|
+
```jsx
|
|
545
|
+
<div className="flex flex-wrap gap-2">
|
|
546
|
+
<Button variantType="primary">Primary</Button>
|
|
547
|
+
<Button variantType="secondary">Secondary</Button>
|
|
548
|
+
<Button variantType="success">Success</Button>
|
|
549
|
+
<Button variantType="info">Info</Button>
|
|
550
|
+
<Button variantType="warning">Warning</Button>
|
|
551
|
+
<Button variantType="error">Error</Button>
|
|
552
|
+
</div>
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
### Button Sizes
|
|
556
|
+
|
|
557
|
+
```jsx
|
|
558
|
+
<div className="flex flex-wrap gap-2 items-center">
|
|
559
|
+
<Button size="sm">Small</Button>
|
|
560
|
+
<Button size="md">Medium</Button>
|
|
561
|
+
<Button size="lg">Large</Button>
|
|
562
|
+
</div>
|
|
563
|
+
```
|
|
564
|
+
|
|
565
|
+
### Button Radius
|
|
566
|
+
|
|
567
|
+
```jsx
|
|
568
|
+
<div className="flex flex-wrap gap-2">
|
|
569
|
+
<Button radius="regular">Regular Radius</Button>
|
|
570
|
+
<Button radius="stadium">Stadium Radius</Button>
|
|
571
|
+
</div>
|
|
572
|
+
```
|
|
573
|
+
|
|
574
|
+
### Button States
|
|
575
|
+
|
|
576
|
+
```jsx
|
|
577
|
+
<div className="flex flex-wrap gap-2">
|
|
578
|
+
<Button>Normal Button</Button>
|
|
579
|
+
<Button disabled>Disabled Button</Button>
|
|
580
|
+
<Button fullWidth>Full Width Button</Button>
|
|
581
|
+
</div>
|
|
582
|
+
```
|
|
583
|
+
|
|
584
|
+
### Buttons with Icons
|
|
585
|
+
|
|
586
|
+
```jsx
|
|
587
|
+
<div className="flex flex-wrap gap-2">
|
|
588
|
+
<Button
|
|
589
|
+
prefixIcon={
|
|
590
|
+
<svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
591
|
+
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" />
|
|
592
|
+
</svg>
|
|
593
|
+
}
|
|
594
|
+
>
|
|
595
|
+
Search
|
|
596
|
+
</Button>
|
|
597
|
+
|
|
598
|
+
<Button
|
|
599
|
+
suffixIcon={
|
|
600
|
+
<svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
601
|
+
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M17 8l4 4m0 0l-4 4m4-4H3" />
|
|
602
|
+
</svg>
|
|
603
|
+
}
|
|
604
|
+
>
|
|
605
|
+
Continue
|
|
606
|
+
</Button>
|
|
607
|
+
</div>
|
|
608
|
+
```
|
|
609
|
+
|
|
610
|
+
### Link Button
|
|
611
|
+
|
|
612
|
+
```jsx
|
|
613
|
+
<Button to="/dashboard" variantType="info">
|
|
614
|
+
Go to Dashboard
|
|
615
|
+
</Button>
|
|
616
|
+
```
|
|
617
|
+
|
|
618
|
+
### Complete Example
|
|
619
|
+
|
|
620
|
+
```jsx
|
|
621
|
+
<div className="space-y-4">
|
|
622
|
+
<div className="flex flex-wrap gap-2">
|
|
623
|
+
<Button
|
|
624
|
+
variant="solid"
|
|
625
|
+
variantType="primary"
|
|
626
|
+
size="lg"
|
|
627
|
+
prefixIcon={<PlusIcon />}
|
|
628
|
+
onClick={() => alert('Button clicked!')}
|
|
629
|
+
>
|
|
630
|
+
Create New
|
|
631
|
+
</Button>
|
|
632
|
+
|
|
633
|
+
<Button
|
|
634
|
+
variant="outline"
|
|
635
|
+
variantType="secondary"
|
|
636
|
+
size="lg"
|
|
637
|
+
>
|
|
638
|
+
Cancel
|
|
639
|
+
</Button>
|
|
640
|
+
</div>
|
|
641
|
+
</div>
|
|
642
|
+
```
|
|
643
|
+
|
|
644
|
+
---
|
|
645
|
+
|
|
646
|
+
## Card
|
|
647
|
+
|
|
648
|
+
The Card component provides a flexible container for displaying content in a structured format.
|
|
649
|
+
|
|
650
|
+
### Import
|
|
651
|
+
|
|
652
|
+
```jsx
|
|
653
|
+
import { Card } from "alope-ui-v3";
|
|
654
|
+
```
|
|
655
|
+
|
|
656
|
+
### Props
|
|
657
|
+
|
|
658
|
+
| Prop | Type | Default | Description |
|
|
659
|
+
|------|------|---------|-------------|
|
|
660
|
+
| `image` | `string` | `undefined` | Image URL |
|
|
661
|
+
| `title` | `string` | `undefined` | Card title |
|
|
662
|
+
| `description` | `string` | `undefined` | Card description |
|
|
663
|
+
| `footer` | `ReactNode` | `undefined` | Card footer content |
|
|
664
|
+
| `ribbon` | `string` | `undefined` | Ribbon text |
|
|
665
|
+
| `horizontal` | `boolean` | `false` | Horizontal layout |
|
|
666
|
+
| `children` | `ReactNode` | `undefined` | Card content |
|
|
667
|
+
| `containerClassName` | `string` | `""` | Container CSS class |
|
|
668
|
+
| `titleClassName` | `string` | `""` | Title CSS class |
|
|
669
|
+
| `descriptionClassName` | `string` | `""` | Description CSS class |
|
|
670
|
+
|
|
671
|
+
### Basic Card
|
|
672
|
+
|
|
673
|
+
```jsx
|
|
674
|
+
<Card
|
|
675
|
+
image="https://images.unsplash.com/photo-1498050108023-c5249f4df085?w=400&h=250&fit=crop"
|
|
676
|
+
title="Web Development"
|
|
677
|
+
description="Build modern web applications with the latest technologies and best practices."
|
|
678
|
+
/>
|
|
679
|
+
```
|
|
680
|
+
|
|
681
|
+
### Card with Footer
|
|
682
|
+
|
|
683
|
+
```jsx
|
|
684
|
+
<Card
|
|
685
|
+
image="https://images.unsplash.com/photo-1498050108023-c5249f4df085?w=400&h=250&fit=crop"
|
|
686
|
+
title="Advanced React Course"
|
|
687
|
+
description="Master React with hooks, context, and advanced patterns. Perfect for developers looking to level up their skills."
|
|
688
|
+
footer={
|
|
689
|
+
<div className="flex justify-between items-center">
|
|
690
|
+
<span className="text-2xl font-bold text-green-600">$99</span>
|
|
691
|
+
<Button size="sm" variantType="primary">Enroll Now</Button>
|
|
692
|
+
</div>
|
|
693
|
+
}
|
|
694
|
+
/>
|
|
695
|
+
```
|
|
696
|
+
|
|
697
|
+
### Card with Ribbon
|
|
698
|
+
|
|
699
|
+
```jsx
|
|
700
|
+
<Card
|
|
701
|
+
image="https://images.unsplash.com/photo-1498050108023-c5249f4df085?w=400&h=250&fit=crop"
|
|
702
|
+
title="Premium Course"
|
|
703
|
+
description="Get access to exclusive content and personalized mentorship."
|
|
704
|
+
ribbon="50% OFF"
|
|
705
|
+
footer={
|
|
706
|
+
<Button fullWidth variantType="success">
|
|
707
|
+
Get Started
|
|
708
|
+
</Button>
|
|
709
|
+
}
|
|
710
|
+
/>
|
|
711
|
+
```
|
|
712
|
+
|
|
713
|
+
### Horizontal Card
|
|
714
|
+
|
|
715
|
+
```jsx
|
|
716
|
+
<Card
|
|
717
|
+
horizontal
|
|
718
|
+
image="https://images.unsplash.com/photo-1498050108023-c5249f4df085?w=400&h=250&fit=crop"
|
|
719
|
+
title="JavaScript Fundamentals"
|
|
720
|
+
description="Learn the core concepts of JavaScript programming from scratch. Perfect for beginners who want to start their coding journey."
|
|
721
|
+
footer={
|
|
722
|
+
<div className="flex gap-2">
|
|
723
|
+
<Button size="sm" variant="outline">Preview</Button>
|
|
724
|
+
<Button size="sm" variantType="primary">Start Learning</Button>
|
|
725
|
+
</div>
|
|
726
|
+
}
|
|
727
|
+
/>
|
|
728
|
+
```
|
|
729
|
+
|
|
730
|
+
### Custom Styling
|
|
731
|
+
|
|
732
|
+
```jsx
|
|
733
|
+
<Card
|
|
734
|
+
image="https://images.unsplash.com/photo-1498050108023-c5249f4df085?w=400&h=250&fit=crop"
|
|
735
|
+
title="Custom Styled Card"
|
|
736
|
+
description="This card demonstrates custom styling capabilities."
|
|
737
|
+
titleClassName="text-3xl font-bold text-purple-700"
|
|
738
|
+
descriptionClassName="text-gray-600 italic"
|
|
739
|
+
containerClassName="border-2 border-purple-200 shadow-lg"
|
|
740
|
+
footer={
|
|
741
|
+
<Button variantType="info" radius="stadium">
|
|
742
|
+
Learn More
|
|
743
|
+
</Button>
|
|
744
|
+
}
|
|
745
|
+
/>
|
|
746
|
+
```
|
|
747
|
+
|
|
748
|
+
### Content-Only Card
|
|
749
|
+
|
|
750
|
+
```jsx
|
|
751
|
+
<Card>
|
|
752
|
+
<div className="p-6">
|
|
753
|
+
<h3 className="text-xl font-semibold mb-4">Custom Content</h3>
|
|
754
|
+
<p className="text-gray-600 mb-4">
|
|
755
|
+
You can also use the Card component as a container for any custom content.
|
|
756
|
+
</p>
|
|
757
|
+
<div className="flex justify-end">
|
|
758
|
+
<Button size="sm">Action</Button>
|
|
759
|
+
</div>
|
|
760
|
+
</div>
|
|
761
|
+
</Card>
|
|
762
|
+
```
|
|
763
|
+
|
|
764
|
+
---
|
|
765
|
+
|
|
766
|
+
## Modal
|
|
767
|
+
|
|
768
|
+
The Modal component provides overlay dialogs for important user interactions and information.
|
|
769
|
+
|
|
770
|
+
### Import
|
|
771
|
+
|
|
772
|
+
```jsx
|
|
773
|
+
import { Modal } from "alope-ui-v3";
|
|
774
|
+
```
|
|
775
|
+
|
|
776
|
+
### Props
|
|
777
|
+
|
|
778
|
+
| Prop | Type | Default | Description |
|
|
779
|
+
|------|------|---------|-------------|
|
|
780
|
+
| `isOpen` | `boolean` | `false` | Modal visibility state |
|
|
781
|
+
| `onClose` | `function` | `required` | Close handler |
|
|
782
|
+
| `title` | `string` | `undefined` | Modal title |
|
|
783
|
+
| `size` | `'sm' \| 'md' \| 'lg' \| 'xl'` | `'md'` | Modal size |
|
|
784
|
+
| `overlayClose` | `boolean` | `true` | Close on overlay click |
|
|
785
|
+
| `children` | `ReactNode` | `undefined` | Modal content |
|
|
786
|
+
|
|
787
|
+
### Basic Modal
|
|
788
|
+
|
|
789
|
+
```jsx
|
|
790
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
791
|
+
|
|
792
|
+
<>
|
|
793
|
+
<Button onClick={() => setIsOpen(true)}>
|
|
794
|
+
Open Modal
|
|
795
|
+
</Button>
|
|
796
|
+
|
|
797
|
+
<Modal
|
|
798
|
+
isOpen={isOpen}
|
|
799
|
+
onClose={() => setIsOpen(false)}
|
|
800
|
+
title="Basic Modal"
|
|
801
|
+
size="md"
|
|
802
|
+
>
|
|
803
|
+
<div className="p-4">
|
|
804
|
+
<p className="text-gray-600 mb-4">
|
|
805
|
+
This is a basic modal example. You can put any content here.
|
|
806
|
+
</p>
|
|
807
|
+
<div className="flex justify-end gap-2">
|
|
808
|
+
<Button
|
|
809
|
+
variant="outline"
|
|
810
|
+
onClick={() => setIsOpen(false)}
|
|
811
|
+
>
|
|
812
|
+
Cancel
|
|
813
|
+
</Button>
|
|
814
|
+
<Button onClick={() => setIsOpen(false)}>
|
|
815
|
+
Confirm
|
|
816
|
+
</Button>
|
|
817
|
+
</div>
|
|
818
|
+
</div>
|
|
819
|
+
</Modal>
|
|
820
|
+
</>
|
|
821
|
+
```
|
|
822
|
+
|
|
823
|
+
### Confirmation Modal
|
|
824
|
+
|
|
825
|
+
```jsx
|
|
826
|
+
const [isDeleteOpen, setIsDeleteOpen] = useState(false);
|
|
827
|
+
|
|
828
|
+
const handleDelete = () => {
|
|
829
|
+
// Perform delete action
|
|
830
|
+
console.log('Item deleted');
|
|
831
|
+
setIsDeleteOpen(false);
|
|
832
|
+
};
|
|
833
|
+
|
|
834
|
+
<>
|
|
835
|
+
<Button variantType="error" onClick={() => setIsDeleteOpen(true)}>
|
|
836
|
+
Delete Item
|
|
837
|
+
</Button>
|
|
838
|
+
|
|
839
|
+
<Modal
|
|
840
|
+
isOpen={isDeleteOpen}
|
|
841
|
+
onClose={() => setIsDeleteOpen(false)}
|
|
842
|
+
title="Confirm Deletion"
|
|
843
|
+
size="sm"
|
|
844
|
+
overlayClose={false}
|
|
845
|
+
>
|
|
846
|
+
<div className="p-4">
|
|
847
|
+
<p className="text-gray-700 mb-6">
|
|
848
|
+
Are you sure you want to delete this item? This action cannot be undone.
|
|
849
|
+
</p>
|
|
850
|
+
<div className="flex justify-end gap-3">
|
|
851
|
+
<Button
|
|
852
|
+
variant="outline"
|
|
853
|
+
onClick={() => setIsDeleteOpen(false)}
|
|
854
|
+
>
|
|
855
|
+
Cancel
|
|
856
|
+
</Button>
|
|
857
|
+
<Button
|
|
858
|
+
variantType="error"
|
|
859
|
+
onClick={handleDelete}
|
|
860
|
+
>
|
|
861
|
+
Yes, Delete
|
|
862
|
+
</Button>
|
|
863
|
+
</div>
|
|
864
|
+
</div>
|
|
865
|
+
</Modal>
|
|
866
|
+
</>
|
|
867
|
+
```
|
|
868
|
+
|
|
869
|
+
### Form Modal
|
|
870
|
+
|
|
871
|
+
```jsx
|
|
872
|
+
const [isFormOpen, setIsFormOpen] = useState(false);
|
|
873
|
+
|
|
874
|
+
<>
|
|
875
|
+
<Button onClick={() => setIsFormOpen(true)}>
|
|
876
|
+
Add User
|
|
877
|
+
</Button>
|
|
878
|
+
|
|
879
|
+
<Modal
|
|
880
|
+
isOpen={isFormOpen}
|
|
881
|
+
onClose={() => setIsFormOpen(false)}
|
|
882
|
+
title="Add New User"
|
|
883
|
+
size="lg"
|
|
884
|
+
>
|
|
885
|
+
<div className="p-6">
|
|
886
|
+
<form className="space-y-4">
|
|
887
|
+
<TextInput
|
|
888
|
+
label="Full Name"
|
|
889
|
+
placeholder="Enter full name"
|
|
890
|
+
required
|
|
891
|
+
/>
|
|
892
|
+
<TextInput
|
|
893
|
+
label="Email Address"
|
|
894
|
+
type="email"
|
|
895
|
+
placeholder="Enter email address"
|
|
896
|
+
required
|
|
897
|
+
/>
|
|
898
|
+
<SelectInput
|
|
899
|
+
label="Role"
|
|
900
|
+
options={[
|
|
901
|
+
{ label: 'Admin', value: 'admin' },
|
|
902
|
+
{ label: 'User', value: 'user' },
|
|
903
|
+
{ label: 'Moderator', value: 'moderator' }
|
|
904
|
+
]}
|
|
905
|
+
placeholder="Select role"
|
|
906
|
+
/>
|
|
907
|
+
<div className="flex justify-end gap-3 pt-4">
|
|
908
|
+
<Button
|
|
909
|
+
type="button"
|
|
910
|
+
variant="outline"
|
|
911
|
+
onClick={() => setIsFormOpen(false)}
|
|
912
|
+
>
|
|
913
|
+
Cancel
|
|
914
|
+
</Button>
|
|
915
|
+
<Button type="submit" variantType="success">
|
|
916
|
+
Create User
|
|
917
|
+
</Button>
|
|
918
|
+
</div>
|
|
919
|
+
</form>
|
|
920
|
+
</div>
|
|
921
|
+
</Modal>
|
|
922
|
+
</>
|
|
923
|
+
```
|
|
924
|
+
|
|
925
|
+
### Modal Sizes
|
|
926
|
+
|
|
927
|
+
```jsx
|
|
928
|
+
<div className="flex flex-wrap gap-2">
|
|
929
|
+
<Button onClick={() => setSmallOpen(true)}>Small Modal</Button>
|
|
930
|
+
<Button onClick={() => setMediumOpen(true)}>Medium Modal</Button>
|
|
931
|
+
<Button onClick={() => setLargeOpen(true)}>Large Modal</Button>
|
|
932
|
+
<Button onClick={() => setXLargeOpen(true)}>X-Large Modal</Button>
|
|
933
|
+
</div>
|
|
934
|
+
```
|
|
935
|
+
|
|
936
|
+
---
|
|
937
|
+
|
|
938
|
+
## Offcanvas
|
|
939
|
+
|
|
940
|
+
The Offcanvas component provides a sliding panel for displaying hidden content like menus or sidebars that slide in from the side.
|
|
941
|
+
|
|
942
|
+
### Import
|
|
943
|
+
|
|
944
|
+
```jsx
|
|
945
|
+
import { Offcanvas } from "alope-ui-v3";
|
|
946
|
+
```
|
|
947
|
+
|
|
948
|
+
### Props
|
|
949
|
+
|
|
950
|
+
| Prop | Type | Default | Description |
|
|
951
|
+
|------|------|---------|-------------|
|
|
952
|
+
| `isOpen` | `boolean` | `false` | Controls visibility of the offcanvas |
|
|
953
|
+
| `onClose` | `() => void` | `required` | Callback function when offcanvas closes |
|
|
954
|
+
| `title` | `string` | `undefined` | Offcanvas header title |
|
|
955
|
+
| `position` | `'left' \| 'right'` | `'left'` | Position where offcanvas slides from |
|
|
956
|
+
| `children` | `ReactNode` | `undefined` | Offcanvas content |
|
|
957
|
+
| `className` | `string` | `""` | Custom CSS class for offcanvas container |
|
|
958
|
+
| `titleClassName` | `string` | `""` | Custom CSS class for title |
|
|
959
|
+
| `closeButtonClassName` | `string` | `""` | Custom CSS class for close button |
|
|
960
|
+
|
|
961
|
+
### Basic Offcanvas
|
|
962
|
+
|
|
963
|
+
```jsx
|
|
964
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
965
|
+
|
|
966
|
+
<Button onClick={() => setIsOpen(true)}>Open Offcanvas</Button>
|
|
967
|
+
|
|
968
|
+
<Offcanvas
|
|
969
|
+
isOpen={isOpen}
|
|
970
|
+
onClose={() => setIsOpen(false)}
|
|
971
|
+
title="Left Offcanvas"
|
|
972
|
+
position="left"
|
|
973
|
+
>
|
|
974
|
+
<p>This is the content of the offcanvas that slides in from the left.</p>
|
|
975
|
+
</Offcanvas>
|
|
976
|
+
```
|
|
977
|
+
|
|
978
|
+
### Right Position Offcanvas
|
|
979
|
+
|
|
980
|
+
```jsx
|
|
981
|
+
<Offcanvas
|
|
982
|
+
isOpen={isRightOpen}
|
|
983
|
+
onClose={() => setIsRightOpen(false)}
|
|
984
|
+
title="Right Offcanvas"
|
|
985
|
+
position="right"
|
|
986
|
+
>
|
|
987
|
+
<p>This is the content of the offcanvas with that slides in from the right.</p>
|
|
988
|
+
</Offcanvas>
|
|
989
|
+
```
|
|
990
|
+
|
|
991
|
+
### Custom Styling
|
|
992
|
+
|
|
993
|
+
```jsx
|
|
994
|
+
<Offcanvas
|
|
995
|
+
isOpen={isRightOpen}
|
|
996
|
+
onClose={() => setIsRightOpen(false)}
|
|
997
|
+
title="Right Offcanvas"
|
|
998
|
+
position="right"
|
|
999
|
+
className="bg-primary-700"
|
|
1000
|
+
titleClassName="text-2xl font-bold text-white"
|
|
1001
|
+
closeButtonClassName="text-white hover:text-white/20"
|
|
1002
|
+
>
|
|
1003
|
+
<div className="text-white">
|
|
1004
|
+
<p>This is the content of the offcanvas with custom styling.</p>
|
|
1005
|
+
<p>You can put any content here, such as text, forms, or other components.</p>
|
|
1006
|
+
</div>
|
|
1007
|
+
</Offcanvas>
|
|
1008
|
+
```
|
|
1009
|
+
|
|
1010
|
+
---
|
|
1011
|
+
|
|
1012
|
+
## Toast
|
|
1013
|
+
|
|
1014
|
+
The Toast component provides brief, auto-dismissable messages to inform users about actions or status updates.
|
|
1015
|
+
|
|
1016
|
+
### Adding Provider
|
|
1017
|
+
|
|
1018
|
+
First, import the ToastProvider
|
|
1019
|
+
|
|
1020
|
+
```jsx
|
|
1021
|
+
import { ToastProvider } from 'alope-ui-v3'
|
|
1022
|
+
```
|
|
1023
|
+
|
|
1024
|
+
Then, wrap your main application component with the provider (e.g. in App.tsx or your entry file):
|
|
1025
|
+
|
|
1026
|
+
```jsx
|
|
1027
|
+
import { StrictMode } from 'react';
|
|
1028
|
+
import { createRoot } from 'react-dom/client';
|
|
1029
|
+
import App from './App';
|
|
1030
|
+
import { ToastProvider } from 'alope-ui-v3';
|
|
1031
|
+
|
|
1032
|
+
createRoot(document.getElementById('root')!).render(
|
|
1033
|
+
<StrictMode>
|
|
1034
|
+
<ToastProvider>
|
|
1035
|
+
<App />
|
|
1036
|
+
</ToastProvider>
|
|
1037
|
+
</StrictMode>
|
|
1038
|
+
);
|
|
1039
|
+
|
|
1040
|
+
```
|
|
1041
|
+
|
|
1042
|
+
### Use Toast
|
|
1043
|
+
|
|
1044
|
+
Finally, you can use the ``useToast()`` hook like this:
|
|
1045
|
+
|
|
1046
|
+
```jsx
|
|
1047
|
+
import { useToast } from 'alope-ui-v3'
|
|
1048
|
+
```
|
|
1049
|
+
|
|
1050
|
+
```jsx
|
|
1051
|
+
const { addToast } = useToast();
|
|
1052
|
+
```
|
|
1053
|
+
|
|
1054
|
+
### Props
|
|
1055
|
+
|
|
1056
|
+
| Prop | Type | Default | Description |
|
|
1057
|
+
|------|------|---------|-------------|
|
|
1058
|
+
| `title` | `string` | `required` | Toast title |
|
|
1059
|
+
| `message` | `string` | `required` | Toast message content |
|
|
1060
|
+
| `type` | `'success' \| 'error' \| 'info' \| 'warning'` | `'info'` | Toast type/variant |
|
|
1061
|
+
| `variant` | `'filled' \| 'outline'` | `'filled'` | Toast visual style |
|
|
1062
|
+
| `position` | `'topLeft' \| 'topRight' \| 'bottomLeft' \| 'bottomRight'` | `'topRight'` | Toast position on screen |
|
|
1063
|
+
|
|
1064
|
+
### Basic Toast
|
|
1065
|
+
|
|
1066
|
+
```jsx
|
|
1067
|
+
import { useToast } from "alope-ui-v3";
|
|
1068
|
+
|
|
1069
|
+
const BasicExample = () => {
|
|
1070
|
+
const { addToast } = useToast();
|
|
1071
|
+
|
|
1072
|
+
return (
|
|
1073
|
+
<div className="flex gap-4">
|
|
1074
|
+
<Button onClick={() => addToast({
|
|
1075
|
+
title: 'Success',
|
|
1076
|
+
message: 'This is a success message!',
|
|
1077
|
+
type: 'success'
|
|
1078
|
+
})}>
|
|
1079
|
+
Success Toast
|
|
1080
|
+
</Button>
|
|
1081
|
+
|
|
1082
|
+
<Button onClick={() => addToast({
|
|
1083
|
+
title: 'Error',
|
|
1084
|
+
message: 'This is an error message!',
|
|
1085
|
+
type: 'error'
|
|
1086
|
+
})}>
|
|
1087
|
+
Error Toast
|
|
1088
|
+
</Button>
|
|
1089
|
+
|
|
1090
|
+
<Button onClick={() => addToast({
|
|
1091
|
+
title: 'Info',
|
|
1092
|
+
message: 'This is an info message!',
|
|
1093
|
+
type: 'info'
|
|
1094
|
+
})}>
|
|
1095
|
+
Info Toast
|
|
1096
|
+
</Button>
|
|
1097
|
+
|
|
1098
|
+
<Button onClick={() => addToast({
|
|
1099
|
+
title: 'Warning',
|
|
1100
|
+
message: 'This is a warning message!',
|
|
1101
|
+
type: 'warning'
|
|
1102
|
+
})}>
|
|
1103
|
+
Warning Toast
|
|
1104
|
+
</Button>
|
|
1105
|
+
</div>
|
|
1106
|
+
);
|
|
1107
|
+
};
|
|
1108
|
+
```
|
|
1109
|
+
|
|
1110
|
+
### Outline Variant
|
|
1111
|
+
|
|
1112
|
+
```jsx
|
|
1113
|
+
<Button onClick={() => addToast({
|
|
1114
|
+
title: 'Success',
|
|
1115
|
+
message: 'This is a success message!',
|
|
1116
|
+
type: 'success',
|
|
1117
|
+
variant: 'outline'
|
|
1118
|
+
})}>
|
|
1119
|
+
Success Outline Toast
|
|
1120
|
+
</Button>
|
|
1121
|
+
|
|
1122
|
+
<Button onClick={() => addToast({
|
|
1123
|
+
title: 'Error',
|
|
1124
|
+
message: 'This is an error message!',
|
|
1125
|
+
type: 'error',
|
|
1126
|
+
variant: 'outline'
|
|
1127
|
+
})}>
|
|
1128
|
+
Error Outline Toast
|
|
1129
|
+
</Button>
|
|
1130
|
+
```
|
|
1131
|
+
|
|
1132
|
+
### Custom Position
|
|
1133
|
+
|
|
1134
|
+
```jsx
|
|
1135
|
+
<Button onClick={() => addToast({
|
|
1136
|
+
title: 'Top Left',
|
|
1137
|
+
message: 'This toast appears at top left!',
|
|
1138
|
+
type: 'success',
|
|
1139
|
+
variant: 'outline',
|
|
1140
|
+
position: 'topLeft'
|
|
1141
|
+
})}>
|
|
1142
|
+
Top Left Toast
|
|
1143
|
+
</Button>
|
|
1144
|
+
|
|
1145
|
+
<Button onClick={() => addToast({
|
|
1146
|
+
title: 'Bottom Right',
|
|
1147
|
+
message: 'This toast appears at bottom right!',
|
|
1148
|
+
type: 'info',
|
|
1149
|
+
variant: 'outline',
|
|
1150
|
+
position: 'bottomRight'
|
|
1151
|
+
})}>
|
|
1152
|
+
Bottom Right Toast
|
|
1153
|
+
</Button>
|
|
1154
|
+
```
|
|
1155
|
+
|
|
1156
|
+
---
|
|
1157
|
+
|
|
1158
|
+
## Checkbox Input
|
|
1159
|
+
|
|
1160
|
+
The CheckboxInput component provides checkbox functionality for selecting single or multiple options, with indeterminate state support.
|
|
1161
|
+
|
|
1162
|
+
### Import
|
|
1163
|
+
|
|
1164
|
+
```jsx
|
|
1165
|
+
import { CheckboxInput, ListCheckboxInput } from "alope-ui-v3";
|
|
1166
|
+
import type { CheckboxOptionType } from "alope-ui-v3";
|
|
1167
|
+
```
|
|
1168
|
+
|
|
1169
|
+
### CheckboxInput Props
|
|
1170
|
+
|
|
1171
|
+
| Prop | Type | Default | Description |
|
|
1172
|
+
|------|------|---------|-------------|
|
|
1173
|
+
| `label` | `string` | `required` | Checkbox label text |
|
|
1174
|
+
| `checked` | `boolean` | `false` | Checkbox checked state |
|
|
1175
|
+
| `indeterminate` | `boolean` | `false` | Indeterminate state for partial selection |
|
|
1176
|
+
| `onChange` | `(e: ChangeEvent<HTMLInputElement>) => void` | `required` | Change handler function |
|
|
1177
|
+
| `description` | `string` | `undefined` | Additional description text |
|
|
1178
|
+
|
|
1179
|
+
### ListCheckboxInput Props
|
|
1180
|
+
|
|
1181
|
+
| Prop | Type | Default | Description |
|
|
1182
|
+
|------|------|---------|-------------|
|
|
1183
|
+
| `options` | `CheckboxOptionType[]` | `required` | Array of checkbox options |
|
|
1184
|
+
| `selectedValues` | `CheckboxOptionType[]` | `[]` | Currently selected options |
|
|
1185
|
+
| `onValueChange` | `(values: CheckboxOptionType[]) => void` | `required` | Change handler for selected values |
|
|
1186
|
+
| `variant` | `'solid' \| 'subtle' \| 'outline'` | `'solid'` | Visual variant style |
|
|
1187
|
+
| `checkboxSize` | `'sm' \| 'md' \| 'lg'` | `'md'` | Checkbox size |
|
|
1188
|
+
| `containerClassName` | `string` | `""` | Container CSS class |
|
|
1189
|
+
|
|
1190
|
+
### Basic CheckboxInput
|
|
1191
|
+
|
|
1192
|
+
```jsx
|
|
1193
|
+
import { useState } from 'react';
|
|
1194
|
+
import { CheckboxInput } from "alope-ui-v3";
|
|
1195
|
+
|
|
1196
|
+
const BasicExample = () => {
|
|
1197
|
+
const [checked, setChecked] = useState(false);
|
|
1198
|
+
|
|
1199
|
+
return (
|
|
1200
|
+
<CheckboxInput
|
|
1201
|
+
label="I agree to the terms and conditions"
|
|
1202
|
+
checked={checked}
|
|
1203
|
+
onChange={(e) => setChecked(e.target.checked)}
|
|
1204
|
+
description="Click this checkbox to proceed."
|
|
1205
|
+
/>
|
|
1206
|
+
);
|
|
1207
|
+
};
|
|
1208
|
+
```
|
|
1209
|
+
|
|
1210
|
+
### ListCheckboxInput
|
|
1211
|
+
|
|
1212
|
+
```jsx
|
|
1213
|
+
import { useState } from 'react';
|
|
1214
|
+
import { ListCheckboxInput } from "alope-ui-v3";
|
|
1215
|
+
import type { CheckboxOptionType } from "alope-ui-v3";
|
|
1216
|
+
|
|
1217
|
+
const options: CheckboxOptionType[] = [
|
|
1218
|
+
{ value: 'chocolate', label: 'Chocolate' },
|
|
1219
|
+
{ value: 'strawberry', label: 'Strawberry' },
|
|
1220
|
+
{ value: 'vanilla', label: 'Vanilla' },
|
|
1221
|
+
];
|
|
1222
|
+
|
|
1223
|
+
const ListExample = () => {
|
|
1224
|
+
const [selectedOptions, setSelectedOptions] = useState<CheckboxOptionType[]>([]);
|
|
1225
|
+
|
|
1226
|
+
return (
|
|
1227
|
+
<ListCheckboxInput
|
|
1228
|
+
options={options}
|
|
1229
|
+
selectedValues={selectedOptions}
|
|
1230
|
+
onValueChange={setSelectedOptions}
|
|
1231
|
+
variant="subtle"
|
|
1232
|
+
checkboxSize="md"
|
|
1233
|
+
/>
|
|
1234
|
+
);
|
|
1235
|
+
};
|
|
1236
|
+
```
|
|
1237
|
+
|
|
1238
|
+
### Select All with Indeterminate State
|
|
1239
|
+
|
|
1240
|
+
```jsx
|
|
1241
|
+
const [selectedOptions, setSelectedOptions] = useState<CheckboxOptionType[]>([]);
|
|
1242
|
+
|
|
1243
|
+
<CheckboxInput
|
|
1244
|
+
label="Select All"
|
|
1245
|
+
checked={selectedOptions.length === options.length}
|
|
1246
|
+
indeterminate={
|
|
1247
|
+
selectedOptions.length > 0 &&
|
|
1248
|
+
selectedOptions.length < options.length
|
|
1249
|
+
}
|
|
1250
|
+
onChange={(e) => {
|
|
1251
|
+
const isChecked = e.target.checked;
|
|
1252
|
+
setSelectedOptions(isChecked ? options : []);
|
|
1253
|
+
}}
|
|
1254
|
+
description="Check to select all options or uncheck to deselect all."
|
|
1255
|
+
/>
|
|
1256
|
+
|
|
1257
|
+
<ListCheckboxInput
|
|
1258
|
+
options={options}
|
|
1259
|
+
selectedValues={selectedOptions}
|
|
1260
|
+
onValueChange={setSelectedOptions}
|
|
1261
|
+
containerClassName="mt-2"
|
|
1262
|
+
variant="subtle"
|
|
1263
|
+
checkboxSize="md"
|
|
1264
|
+
/>
|
|
1265
|
+
```
|
|
1266
|
+
|
|
1267
|
+
### Variants
|
|
1268
|
+
|
|
1269
|
+
```jsx
|
|
1270
|
+
{/* Solid Variant */}
|
|
1271
|
+
<ListCheckboxInput
|
|
1272
|
+
options={options}
|
|
1273
|
+
selectedValues={selectedOptions}
|
|
1274
|
+
onValueChange={setSelectedOptions}
|
|
1275
|
+
variant="solid"
|
|
1276
|
+
checkboxSize="md"
|
|
1277
|
+
/>
|
|
1278
|
+
|
|
1279
|
+
{/* Subtle Variant */}
|
|
1280
|
+
<ListCheckboxInput
|
|
1281
|
+
options={options}
|
|
1282
|
+
selectedValues={selectedOptions}
|
|
1283
|
+
onValueChange={setSelectedOptions}
|
|
1284
|
+
variant="subtle"
|
|
1285
|
+
checkboxSize="md"
|
|
1286
|
+
/>
|
|
1287
|
+
|
|
1288
|
+
{/* Outline Variant */}
|
|
1289
|
+
<ListCheckboxInput
|
|
1290
|
+
options={options}
|
|
1291
|
+
selectedValues={selectedOptions}
|
|
1292
|
+
onValueChange={setSelectedOptions}
|
|
1293
|
+
variant="outline"
|
|
1294
|
+
checkboxSize="md"
|
|
1295
|
+
/>
|
|
1296
|
+
```
|
|
1297
|
+
|
|
1298
|
+
### Sizes
|
|
1299
|
+
|
|
1300
|
+
```jsx
|
|
1301
|
+
{/* Large Size */}
|
|
1302
|
+
<ListCheckboxInput
|
|
1303
|
+
options={options}
|
|
1304
|
+
selectedValues={selectedOptions}
|
|
1305
|
+
onValueChange={setSelectedOptions}
|
|
1306
|
+
variant="solid"
|
|
1307
|
+
checkboxSize="lg"
|
|
1308
|
+
/>
|
|
1309
|
+
```
|
|
1310
|
+
|
|
1311
|
+
---
|
|
1312
|
+
|
|
1313
|
+
## Radio Input
|
|
1314
|
+
|
|
1315
|
+
The RadioInput component allows users to choose one option from a list of mutually exclusive choices.
|
|
1316
|
+
|
|
1317
|
+
### Import
|
|
1318
|
+
|
|
1319
|
+
```jsx
|
|
1320
|
+
import { RadioInput } from "alope-ui-v3";
|
|
1321
|
+
import type { RadioOptionType } from "alope-ui-v3";
|
|
1322
|
+
```
|
|
1323
|
+
|
|
1324
|
+
### Props
|
|
1325
|
+
|
|
1326
|
+
| Prop | Type | Default | Description |
|
|
1327
|
+
|------|------|---------|-------------|
|
|
1328
|
+
| `name` | `string` | `required` | Name attribute for radio group |
|
|
1329
|
+
| `options` | `RadioOptionType[]` | `required` | Array of radio options |
|
|
1330
|
+
| `selectedValue` | `RadioOptionType \| undefined` | `undefined` | Currently selected option |
|
|
1331
|
+
| `onValueChange` | `(value: RadioOptionType) => void` | `required` | Change handler function |
|
|
1332
|
+
| `variant` | `'subtle' \| 'solid' \| 'outline'` | `'subtle'` | Visual variant style |
|
|
1333
|
+
| `radioSize` | `'sm' \| 'md' \| 'lg'` | `'md'` | Radio button size |
|
|
1334
|
+
| `disabled` | `boolean` | `false` | Disable all radio options |
|
|
1335
|
+
| `containerClassName` | `string` | `""` | Container CSS class |
|
|
1336
|
+
| `inputGroupClassName` | `string \| (isChecked: boolean) => string` | `""` | Input group CSS class |
|
|
1337
|
+
| `inputLabelClassName` | `string \| (isChecked: boolean) => string` | `""` | Label CSS class |
|
|
1338
|
+
| `inputRadioClassName` | `string \| (isChecked: boolean) => string` | `""` | Radio input CSS class |
|
|
1339
|
+
|
|
1340
|
+
### Basic RadioInput
|
|
1341
|
+
|
|
1342
|
+
```jsx
|
|
1343
|
+
import { useState } from 'react';
|
|
1344
|
+
import { RadioInput } from "alope-ui-v3";
|
|
1345
|
+
import type { RadioOptionType } from "alope-ui-v3";
|
|
1346
|
+
|
|
1347
|
+
const options: RadioOptionType[] = [
|
|
1348
|
+
{ value: 'chocolate', label: 'Chocolate' },
|
|
1349
|
+
{ value: 'strawberry', label: 'Strawberry' },
|
|
1350
|
+
{ value: 'vanilla', label: 'Vanilla' },
|
|
1351
|
+
];
|
|
1352
|
+
|
|
1353
|
+
const BasicExample = () => {
|
|
1354
|
+
const [selectedValue, setSelectedValue] = useState<RadioOptionType | undefined>(options[0]);
|
|
1355
|
+
|
|
1356
|
+
return (
|
|
1357
|
+
<RadioInput
|
|
1358
|
+
name="flavor"
|
|
1359
|
+
options={options}
|
|
1360
|
+
selectedValue={selectedValue}
|
|
1361
|
+
onValueChange={setSelectedValue}
|
|
1362
|
+
/>
|
|
1363
|
+
);
|
|
1364
|
+
};
|
|
1365
|
+
```
|
|
1366
|
+
|
|
1367
|
+
### Variants
|
|
1368
|
+
|
|
1369
|
+
```jsx
|
|
1370
|
+
{/* Subtle Variant */}
|
|
1371
|
+
<RadioInput
|
|
1372
|
+
name="variant-subtle"
|
|
1373
|
+
options={options}
|
|
1374
|
+
selectedValue={selectedValue}
|
|
1375
|
+
onValueChange={setSelectedValue}
|
|
1376
|
+
variant="subtle"
|
|
1377
|
+
/>
|
|
1378
|
+
|
|
1379
|
+
{/* Solid Variant */}
|
|
1380
|
+
<RadioInput
|
|
1381
|
+
name="variant-solid"
|
|
1382
|
+
options={options}
|
|
1383
|
+
selectedValue={selectedValue}
|
|
1384
|
+
onValueChange={setSelectedValue}
|
|
1385
|
+
variant="solid"
|
|
1386
|
+
/>
|
|
1387
|
+
|
|
1388
|
+
{/* Outline Variant */}
|
|
1389
|
+
<RadioInput
|
|
1390
|
+
name="variant-outline"
|
|
1391
|
+
options={options}
|
|
1392
|
+
selectedValue={selectedValue}
|
|
1393
|
+
onValueChange={setSelectedValue}
|
|
1394
|
+
variant="outline"
|
|
1395
|
+
/>
|
|
1396
|
+
```
|
|
1397
|
+
|
|
1398
|
+
### Sizes
|
|
1399
|
+
|
|
1400
|
+
```jsx
|
|
1401
|
+
{/* Small Size */}
|
|
1402
|
+
<RadioInput
|
|
1403
|
+
name="size-sm"
|
|
1404
|
+
options={options}
|
|
1405
|
+
selectedValue={selectedValue}
|
|
1406
|
+
onValueChange={setSelectedValue}
|
|
1407
|
+
radioSize="sm"
|
|
1408
|
+
/>
|
|
1409
|
+
|
|
1410
|
+
{/* Large Size */}
|
|
1411
|
+
<RadioInput
|
|
1412
|
+
name="size-lg"
|
|
1413
|
+
options={options}
|
|
1414
|
+
selectedValue={selectedValue}
|
|
1415
|
+
onValueChange={setSelectedValue}
|
|
1416
|
+
radioSize="lg"
|
|
1417
|
+
/>
|
|
1418
|
+
```
|
|
1419
|
+
|
|
1420
|
+
### Disabled State
|
|
1421
|
+
|
|
1422
|
+
```jsx
|
|
1423
|
+
<RadioInput
|
|
1424
|
+
name="disabled-example"
|
|
1425
|
+
options={options}
|
|
1426
|
+
selectedValue={selectedValue}
|
|
1427
|
+
onValueChange={setSelectedValue}
|
|
1428
|
+
disabled
|
|
1429
|
+
/>
|
|
1430
|
+
```
|
|
1431
|
+
|
|
1432
|
+
### Custom Styling
|
|
1433
|
+
|
|
1434
|
+
```jsx
|
|
1435
|
+
<RadioInput
|
|
1436
|
+
name="custom-styling"
|
|
1437
|
+
options={options}
|
|
1438
|
+
selectedValue={selectedValue}
|
|
1439
|
+
onValueChange={setSelectedValue}
|
|
1440
|
+
containerClassName="gap-6 bg-blue-50 p-4 rounded-lg"
|
|
1441
|
+
inputGroupClassName={(isChecked) =>
|
|
1442
|
+
isChecked
|
|
1443
|
+
? 'bg-blue-100 border-blue-500 shadow-md'
|
|
1444
|
+
: 'bg-white border-gray-300 hover:bg-gray-100'
|
|
1445
|
+
}
|
|
1446
|
+
inputLabelClassName={(isChecked) =>
|
|
1447
|
+
isChecked ? 'text-blue-800 font-bold' : 'text-gray-600'
|
|
1448
|
+
}
|
|
1449
|
+
inputRadioClassName={(isChecked) =>
|
|
1450
|
+
isChecked ? 'bg-blue-600 border-blue-600' : 'bg-white border-gray-400'
|
|
1451
|
+
}
|
|
1452
|
+
/>
|
|
1453
|
+
```
|
|
1454
|
+
|
|
1455
|
+
---
|
|
1456
|
+
|
|
1457
|
+
## Select Input
|
|
1458
|
+
|
|
1459
|
+
The SelectInput component provides a dropdown interface for selecting one or multiple options from a list.
|
|
1460
|
+
|
|
1461
|
+
### Import
|
|
1462
|
+
|
|
1463
|
+
```jsx
|
|
1464
|
+
import { SelectInput } from "alope-ui-v3";
|
|
1465
|
+
import type { SelectOptionType } from "alope-ui-v3";
|
|
1466
|
+
```
|
|
1467
|
+
|
|
1468
|
+
### Props
|
|
1469
|
+
|
|
1470
|
+
| Prop | Type | Default | Description |
|
|
1471
|
+
|------|------|---------|-------------|
|
|
1472
|
+
| `instanceId` | `string` | `required` | Unique identifier for the select instance |
|
|
1473
|
+
| `label` | `string` | `undefined` | Label text for the select |
|
|
1474
|
+
| `options` | `SelectOptionType[]` | `required` | Array of selectable options |
|
|
1475
|
+
| `value` | `SelectOptionType \| SelectOptionType[] \| null` | `null` | Selected value(s) |
|
|
1476
|
+
| `onChange` | `(value: any) => void` | `required` | Change handler function |
|
|
1477
|
+
| `placeholder` | `string` | `"Select..."` | Placeholder text |
|
|
1478
|
+
| `isMulti` | `boolean` | `false` | Enable multiple selection |
|
|
1479
|
+
| `isSearchable` | `boolean` | `false` | Enable search functionality |
|
|
1480
|
+
| `isClearable` | `boolean` | `false` | Enable clear button |
|
|
1481
|
+
| `error` | `string` | `undefined` | Error message to display |
|
|
1482
|
+
| `labelClassName` | `string` | `""` | Label CSS class |
|
|
1483
|
+
| `customClassNames` | `object` | `{}` | Custom class names for react-select components |
|
|
1484
|
+
|
|
1485
|
+
### Single Select
|
|
1486
|
+
|
|
1487
|
+
```jsx
|
|
1488
|
+
import { useState } from 'react';
|
|
1489
|
+
import { SelectInput } from "alope-ui-v3";
|
|
1490
|
+
import type { SelectOptionType } from "alope-ui-v3";
|
|
1491
|
+
|
|
1492
|
+
const options: SelectOptionType[] = [
|
|
1493
|
+
{ value: 'chocolate', label: 'Chocolate' },
|
|
1494
|
+
{ value: 'strawberry', label: 'Strawberry' },
|
|
1495
|
+
{ value: 'vanilla', label: 'Vanilla' },
|
|
1496
|
+
];
|
|
1497
|
+
|
|
1498
|
+
const SingleExample = () => {
|
|
1499
|
+
const [value, setValue] = useState<SelectOptionType | null>(null);
|
|
1500
|
+
|
|
1501
|
+
return (
|
|
1502
|
+
<SelectInput
|
|
1503
|
+
instanceId="single-select"
|
|
1504
|
+
label="Choose your flavor"
|
|
1505
|
+
options={options}
|
|
1506
|
+
value={value}
|
|
1507
|
+
onChange={(value) => setValue(value as SelectOptionType)}
|
|
1508
|
+
isClearable
|
|
1509
|
+
isSearchable
|
|
1510
|
+
placeholder="Select a flavor..."
|
|
1511
|
+
/>
|
|
1512
|
+
);
|
|
1513
|
+
};
|
|
1514
|
+
```
|
|
1515
|
+
|
|
1516
|
+
### Multiple Select
|
|
1517
|
+
|
|
1518
|
+
```jsx
|
|
1519
|
+
const [multipleValues, setMultipleValues] = useState<readonly SelectOptionType[]>([]);
|
|
1520
|
+
|
|
1521
|
+
<SelectInput
|
|
1522
|
+
instanceId="multi-select"
|
|
1523
|
+
label="Select your favorite toppings"
|
|
1524
|
+
options={options}
|
|
1525
|
+
value={multipleValues}
|
|
1526
|
+
onChange={(value) => setMultipleValues(value as readonly SelectOptionType[])}
|
|
1527
|
+
isMulti
|
|
1528
|
+
isSearchable
|
|
1529
|
+
placeholder="Select toppings..."
|
|
1530
|
+
/>
|
|
1531
|
+
```
|
|
1532
|
+
|
|
1533
|
+
### Select with Error
|
|
1534
|
+
|
|
1535
|
+
```jsx
|
|
1536
|
+
<SelectInput
|
|
1537
|
+
instanceId="error-select"
|
|
1538
|
+
label="Your selection"
|
|
1539
|
+
options={options}
|
|
1540
|
+
error="This field is required."
|
|
1541
|
+
placeholder="Make a selection..."
|
|
1542
|
+
/>
|
|
1543
|
+
```
|
|
1544
|
+
|
|
1545
|
+
### Custom Styling
|
|
1546
|
+
|
|
1547
|
+
```jsx
|
|
1548
|
+
<SelectInput
|
|
1549
|
+
instanceId="custom-select"
|
|
1550
|
+
label="Your selection"
|
|
1551
|
+
options={options}
|
|
1552
|
+
placeholder="Custom styled select..."
|
|
1553
|
+
labelClassName="font-bold text-lg"
|
|
1554
|
+
customClassNames={{
|
|
1555
|
+
control: ({ isFocused }) => cn(
|
|
1556
|
+
'!w-full !border !rounded-lg p-2 !shadow-md !sm:text-sm !min-h-[38px]',
|
|
1557
|
+
isFocused
|
|
1558
|
+
? 'border-info !ring-1 !ring-info'
|
|
1559
|
+
: '!border-info'
|
|
1560
|
+
),
|
|
1561
|
+
option: ({ isFocused, isSelected }) =>
|
|
1562
|
+
`!px-4 !py-2 !cursor-pointer ${
|
|
1563
|
+
isSelected
|
|
1564
|
+
? '!bg-info !text-white'
|
|
1565
|
+
: isFocused
|
|
1566
|
+
? '!bg-info/30'
|
|
1567
|
+
: '!bg-white'
|
|
1568
|
+
}`,
|
|
1569
|
+
}}
|
|
1570
|
+
/>
|
|
1571
|
+
```
|
|
1572
|
+
|
|
1573
|
+
---
|
|
1574
|
+
|
|
1575
|
+
## Text Input
|
|
1576
|
+
|
|
1577
|
+
The TextInput component provides a text input field for users to enter text information.
|
|
1578
|
+
|
|
1579
|
+
### Import
|
|
1580
|
+
|
|
1581
|
+
```jsx
|
|
1582
|
+
import { TextInput } from "alope-ui-v3";
|
|
1583
|
+
```
|
|
1584
|
+
|
|
1585
|
+
### Props
|
|
1586
|
+
|
|
1587
|
+
| Prop | Type | Default | Description |
|
|
1588
|
+
|------|------|---------|-------------|
|
|
1589
|
+
| `id` | `string` | `required` | Input element ID |
|
|
1590
|
+
| `name` | `string` | `required` | Input name attribute |
|
|
1591
|
+
| `label` | `string` | `undefined` | Label text for the input |
|
|
1592
|
+
| `placeholder` | `string` | `undefined` | Placeholder text |
|
|
1593
|
+
| `error` | `string` | `undefined` | Error message to display |
|
|
1594
|
+
| `disabled` | `boolean` | `false` | Disable the input |
|
|
1595
|
+
|
|
1596
|
+
### Basic TextInput
|
|
1597
|
+
|
|
1598
|
+
```jsx
|
|
1599
|
+
import { TextInput } from "alope-ui-v3";
|
|
1600
|
+
|
|
1601
|
+
const BasicExample = () => {
|
|
1602
|
+
return (
|
|
1603
|
+
<TextInput
|
|
1604
|
+
id="basic"
|
|
1605
|
+
name="basic"
|
|
1606
|
+
placeholder="Enter text here"
|
|
1607
|
+
/>
|
|
1608
|
+
);
|
|
1609
|
+
};
|
|
1610
|
+
```
|
|
1611
|
+
|
|
1612
|
+
### With Label
|
|
1613
|
+
|
|
1614
|
+
```jsx
|
|
1615
|
+
<TextInput
|
|
1616
|
+
id="with-label"
|
|
1617
|
+
name="with-label"
|
|
1618
|
+
label="Your Name"
|
|
1619
|
+
placeholder="John Doe"
|
|
1620
|
+
/>
|
|
1621
|
+
```
|
|
1622
|
+
|
|
1623
|
+
### With Error
|
|
1624
|
+
|
|
1625
|
+
```jsx
|
|
1626
|
+
<TextInput
|
|
1627
|
+
id="with-error"
|
|
1628
|
+
name="with-error"
|
|
1629
|
+
label="Email Address"
|
|
1630
|
+
placeholder="you@example.com"
|
|
1631
|
+
error="Please enter a valid email."
|
|
1632
|
+
/>
|
|
1633
|
+
```
|
|
1634
|
+
|
|
1635
|
+
### Disabled State
|
|
1636
|
+
|
|
1637
|
+
```jsx
|
|
1638
|
+
<TextInput
|
|
1639
|
+
id="disabled"
|
|
1640
|
+
name="disabled"
|
|
1641
|
+
label="Disabled Input"
|
|
1642
|
+
placeholder="You can't type here"
|
|
1643
|
+
disabled
|
|
1644
|
+
/>
|
|
1645
|
+
```
|
|
1646
|
+
|
|
1647
|
+
## 💡 Contributing
|
|
1648
|
+
|
|
1649
|
+
We welcome contributions! If you want to add features, fix bugs, or improve documentation, feel free to fork this project and submit a pull request.
|
|
1650
|
+
|
|
1651
|
+
---
|
|
1652
|
+
|
|
1653
|
+
## 📄 License
|
|
1654
|
+
|
|
1655
|
+
MIT License – Free to use, modify, and distribute.
|
|
1656
|
+
|
|
1657
|
+
---
|
|
1658
|
+
|
|
1659
|
+
## 🙌 Thank You
|
|
1660
|
+
|
|
1661
|
+
Thank you for using **ALOPE UI Library**. We hope this helps you build beautiful and functional user interfaces with ease.
|