@app-studio/web 0.9.31 → 0.9.33
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/docs/components/Accordion.mdx +158 -0
- package/docs/components/Alert.mdx +123 -0
- package/docs/components/AspectRatio.mdx +55 -0
- package/docs/components/Avatar.mdx +85 -0
- package/docs/components/Background.mdx +522 -0
- package/docs/components/Badge.mdx +220 -0
- package/docs/components/Button.mdx +272 -0
- package/docs/components/Calendar.mdx +274 -0
- package/docs/components/Card.mdx +341 -0
- package/docs/components/Carousel.mdx +411 -0
- package/docs/components/Center.mdx +474 -0
- package/docs/components/Chart.mdx +232 -0
- package/docs/components/ChatInput.mdx +373 -0
- package/docs/components/Checkbox.mdx +66 -0
- package/docs/components/ColorInput.mdx +209 -0
- package/docs/components/ComboBox.mdx +364 -0
- package/docs/components/Command.mdx +252 -0
- package/docs/components/ContextMenu.mdx +219 -0
- package/docs/components/CountryPicker.mdx +123 -0
- package/docs/components/DatePicker.mdx +77 -0
- package/docs/components/DragAndDrop.mdx +539 -0
- package/docs/components/DropdownMenu.mdx +205 -0
- package/docs/components/File.mdx +8 -0
- package/docs/components/Flow.mdx +257 -0
- package/docs/components/Form.mdx +681 -0
- package/docs/components/Formik.mdx +621 -0
- package/docs/components/Gradient.mdx +271 -0
- package/docs/components/Horizontal.mdx +40 -0
- package/docs/components/HoverCard.mdx +140 -0
- package/docs/components/Icon.mdx +438 -0
- package/docs/components/Label.mdx +438 -0
- package/docs/components/Link.mdx +83 -0
- package/docs/components/Loader.mdx +527 -0
- package/docs/components/Menubar.mdx +124 -0
- package/docs/components/Message.mdx +571 -0
- package/docs/components/Modal.mdx +533 -0
- package/docs/components/NavigationMenu.mdx +165 -0
- package/docs/components/Pagination.mdx +150 -0
- package/docs/components/Password.mdx +121 -0
- package/docs/components/Resizable.mdx +148 -0
- package/docs/components/Select.mdx +126 -0
- package/docs/components/Separator.mdx +121 -0
- package/docs/components/Sidebar.mdx +147 -0
- package/docs/components/Slider.mdx +232 -0
- package/docs/components/Switch.mdx +62 -0
- package/docs/components/Table.mdx +409 -0
- package/docs/components/Tabs.mdx +215 -0
- package/docs/components/TagInput.mdx +528 -0
- package/docs/components/Text.mdx +163 -0
- package/docs/components/TextArea.mdx +136 -0
- package/docs/components/TextField.mdx +225 -0
- package/docs/components/Title.mdx +535 -0
- package/docs/components/Toast.mdx +165 -0
- package/docs/components/Toggle.mdx +141 -0
- package/docs/components/ToggleGroup.mdx +165 -0
- package/docs/components/Tooltip.mdx +191 -0
- package/docs/components/Tree.mdx +340 -0
- package/docs/components/Uploader.mdx +426 -0
- package/docs/components/Vertical.mdx +566 -0
- package/docs/components.md +285 -0
- package/package.json +1 -1
|
@@ -0,0 +1,566 @@
|
|
|
1
|
+
# Vertical
|
|
2
|
+
|
|
3
|
+
A flexible layout component that arranges its children in a vertical stack using CSS Flexbox. Perfect for creating column layouts, forms, navigation menus, and any vertical arrangement of elements with powerful spacing and alignment options.
|
|
4
|
+
|
|
5
|
+
### **Import**
|
|
6
|
+
```tsx
|
|
7
|
+
import { Vertical } from '@app-studio/web';
|
|
8
|
+
// or from app-studio
|
|
9
|
+
import { Vertical } from 'app-studio';
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
### **Basic Usage**
|
|
13
|
+
```tsx
|
|
14
|
+
import React from 'react';
|
|
15
|
+
import { Vertical } from 'app-studio';
|
|
16
|
+
import { View, Text } from 'app-studio';
|
|
17
|
+
|
|
18
|
+
export const BasicVertical = () => (
|
|
19
|
+
<Vertical>
|
|
20
|
+
<View height={50} backgroundColor="theme.primary" />
|
|
21
|
+
<View height={50} backgroundColor="theme.secondary" />
|
|
22
|
+
<View height={50} backgroundColor="theme.warning" />
|
|
23
|
+
</Vertical>
|
|
24
|
+
);
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### **With Gap Spacing**
|
|
28
|
+
```tsx
|
|
29
|
+
import React from 'react';
|
|
30
|
+
import { Vertical } from 'app-studio';
|
|
31
|
+
import { View, Text } from 'app-studio';
|
|
32
|
+
|
|
33
|
+
export const VerticalWithGap = () => (
|
|
34
|
+
<Vertical gap={16}>
|
|
35
|
+
<View padding={16} backgroundColor="color.blue.100" borderRadius={8}>
|
|
36
|
+
<Text>First Item</Text>
|
|
37
|
+
</View>
|
|
38
|
+
<View padding={16} backgroundColor="color.green.100" borderRadius={8}>
|
|
39
|
+
<Text>Second Item</Text>
|
|
40
|
+
</View>
|
|
41
|
+
<View padding={16} backgroundColor="color.purple.100" borderRadius={8}>
|
|
42
|
+
<Text>Third Item</Text>
|
|
43
|
+
</View>
|
|
44
|
+
</Vertical>
|
|
45
|
+
);
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### **Alignment Options**
|
|
49
|
+
```tsx
|
|
50
|
+
import React from 'react';
|
|
51
|
+
import { Vertical } from 'app-studio';
|
|
52
|
+
import { View, Text } from 'app-studio';
|
|
53
|
+
|
|
54
|
+
export const VerticalAlignment = () => (
|
|
55
|
+
<Vertical gap={20}>
|
|
56
|
+
{/* Left aligned (default) */}
|
|
57
|
+
<Vertical alignItems="flex-start" gap={8}>
|
|
58
|
+
<Text fontWeight="bold">Left Aligned</Text>
|
|
59
|
+
<View width={100} height={40} backgroundColor="color.red.200" />
|
|
60
|
+
<View width={150} height={40} backgroundColor="color.red.300" />
|
|
61
|
+
<View width={80} height={40} backgroundColor="color.red.400" />
|
|
62
|
+
</Vertical>
|
|
63
|
+
|
|
64
|
+
{/* Center aligned */}
|
|
65
|
+
<Vertical alignItems="center" gap={8}>
|
|
66
|
+
<Text fontWeight="bold">Center Aligned</Text>
|
|
67
|
+
<View width={100} height={40} backgroundColor="color.blue.200" />
|
|
68
|
+
<View width={150} height={40} backgroundColor="color.blue.300" />
|
|
69
|
+
<View width={80} height={40} backgroundColor="color.blue.400" />
|
|
70
|
+
</Vertical>
|
|
71
|
+
|
|
72
|
+
{/* Right aligned */}
|
|
73
|
+
<Vertical alignItems="flex-end" gap={8}>
|
|
74
|
+
<Text fontWeight="bold">Right Aligned</Text>
|
|
75
|
+
<View width={100} height={40} backgroundColor="color.green.200" />
|
|
76
|
+
<View width={150} height={40} backgroundColor="color.green.300" />
|
|
77
|
+
<View width={80} height={40} backgroundColor="color.green.400" />
|
|
78
|
+
</Vertical>
|
|
79
|
+
|
|
80
|
+
{/* Stretched */}
|
|
81
|
+
<Vertical alignItems="stretch" gap={8} width={200}>
|
|
82
|
+
<Text fontWeight="bold">Stretched</Text>
|
|
83
|
+
<View height={40} backgroundColor="color.purple.200" />
|
|
84
|
+
<View height={40} backgroundColor="color.purple.300" />
|
|
85
|
+
<View height={40} backgroundColor="color.purple.400" />
|
|
86
|
+
</Vertical>
|
|
87
|
+
</Vertical>
|
|
88
|
+
);
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### **Justification Options**
|
|
92
|
+
```tsx
|
|
93
|
+
import React from 'react';
|
|
94
|
+
import { Vertical } from 'app-studio';
|
|
95
|
+
import { View, Text } from 'app-studio';
|
|
96
|
+
|
|
97
|
+
export const VerticalJustification = () => (
|
|
98
|
+
<Vertical gap={20}>
|
|
99
|
+
{/* Start justified (default) */}
|
|
100
|
+
<View height={200} border="1px solid" borderColor="color.gray.300">
|
|
101
|
+
<Vertical justifyContent="flex-start" height="100%">
|
|
102
|
+
<Text>Start Justified</Text>
|
|
103
|
+
<View width={100} height={30} backgroundColor="color.red.300" />
|
|
104
|
+
<View width={100} height={30} backgroundColor="color.red.400" />
|
|
105
|
+
</Vertical>
|
|
106
|
+
</View>
|
|
107
|
+
|
|
108
|
+
{/* Center justified */}
|
|
109
|
+
<View height={200} border="1px solid" borderColor="color.gray.300">
|
|
110
|
+
<Vertical justifyContent="center" height="100%">
|
|
111
|
+
<Text>Center Justified</Text>
|
|
112
|
+
<View width={100} height={30} backgroundColor="color.blue.300" />
|
|
113
|
+
<View width={100} height={30} backgroundColor="color.blue.400" />
|
|
114
|
+
</Vertical>
|
|
115
|
+
</View>
|
|
116
|
+
|
|
117
|
+
{/* End justified */}
|
|
118
|
+
<View height={200} border="1px solid" borderColor="color.gray.300">
|
|
119
|
+
<Vertical justifyContent="flex-end" height="100%">
|
|
120
|
+
<Text>End Justified</Text>
|
|
121
|
+
<View width={100} height={30} backgroundColor="color.green.300" />
|
|
122
|
+
<View width={100} height={30} backgroundColor="color.green.400" />
|
|
123
|
+
</Vertical>
|
|
124
|
+
</View>
|
|
125
|
+
|
|
126
|
+
{/* Space between */}
|
|
127
|
+
<View height={200} border="1px solid" borderColor="color.gray.300">
|
|
128
|
+
<Vertical justifyContent="space-between" height="100%">
|
|
129
|
+
<Text>Space Between</Text>
|
|
130
|
+
<View width={100} height={30} backgroundColor="color.purple.300" />
|
|
131
|
+
<View width={100} height={30} backgroundColor="color.purple.400" />
|
|
132
|
+
</Vertical>
|
|
133
|
+
</View>
|
|
134
|
+
</Vertical>
|
|
135
|
+
);
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### **Form Layout Example**
|
|
139
|
+
```tsx
|
|
140
|
+
import React from 'react';
|
|
141
|
+
import { Vertical } from 'app-studio';
|
|
142
|
+
import { TextField, Button, Checkbox } from '@app-studio/web';
|
|
143
|
+
import { Text } from 'app-studio';
|
|
144
|
+
|
|
145
|
+
export const FormLayout = () => (
|
|
146
|
+
<Vertical gap={20} width="100%" maxWidth={400} padding={24}>
|
|
147
|
+
<Text fontSize={24} fontWeight="bold">
|
|
148
|
+
Contact Form
|
|
149
|
+
</Text>
|
|
150
|
+
|
|
151
|
+
<Vertical gap={16}>
|
|
152
|
+
<TextField
|
|
153
|
+
label="Full Name"
|
|
154
|
+
placeholder="Enter your full name"
|
|
155
|
+
/>
|
|
156
|
+
|
|
157
|
+
<TextField
|
|
158
|
+
label="Email"
|
|
159
|
+
type="email"
|
|
160
|
+
placeholder="Enter your email"
|
|
161
|
+
/>
|
|
162
|
+
|
|
163
|
+
<TextField
|
|
164
|
+
label="Phone"
|
|
165
|
+
type="tel"
|
|
166
|
+
placeholder="Enter your phone number"
|
|
167
|
+
/>
|
|
168
|
+
|
|
169
|
+
<TextField
|
|
170
|
+
label="Message"
|
|
171
|
+
multiline
|
|
172
|
+
rows={4}
|
|
173
|
+
placeholder="Enter your message"
|
|
174
|
+
/>
|
|
175
|
+
|
|
176
|
+
<Checkbox
|
|
177
|
+
label="I agree to the terms and conditions"
|
|
178
|
+
/>
|
|
179
|
+
|
|
180
|
+
<Button variant="filled" colorScheme="theme.primary">
|
|
181
|
+
Send Message
|
|
182
|
+
</Button>
|
|
183
|
+
</Vertical>
|
|
184
|
+
</Vertical>
|
|
185
|
+
);
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### **Navigation Menu Example**
|
|
189
|
+
```tsx
|
|
190
|
+
import React from 'react';
|
|
191
|
+
import { Vertical } from 'app-studio';
|
|
192
|
+
import { View, Text, Horizontal } from 'app-studio';
|
|
193
|
+
import { HomeIcon, UserIcon, SettingsIcon, LogoutIcon } from '@app-studio/web';
|
|
194
|
+
|
|
195
|
+
export const NavigationMenu = () => (
|
|
196
|
+
<Vertical
|
|
197
|
+
width={250}
|
|
198
|
+
height="100vh"
|
|
199
|
+
backgroundColor="color.gray.900"
|
|
200
|
+
padding={16}
|
|
201
|
+
gap={8}
|
|
202
|
+
>
|
|
203
|
+
<Text
|
|
204
|
+
color="color.white"
|
|
205
|
+
fontSize={20}
|
|
206
|
+
fontWeight="bold"
|
|
207
|
+
marginBottom={24}
|
|
208
|
+
>
|
|
209
|
+
Dashboard
|
|
210
|
+
</Text>
|
|
211
|
+
|
|
212
|
+
<Vertical gap={4}>
|
|
213
|
+
{[
|
|
214
|
+
{ icon: HomeIcon, label: 'Home', active: true },
|
|
215
|
+
{ icon: UserIcon, label: 'Profile', active: false },
|
|
216
|
+
{ icon: SettingsIcon, label: 'Settings', active: false },
|
|
217
|
+
].map((item, index) => (
|
|
218
|
+
<Horizontal
|
|
219
|
+
key={index}
|
|
220
|
+
alignItems="center"
|
|
221
|
+
gap={12}
|
|
222
|
+
padding={12}
|
|
223
|
+
borderRadius={8}
|
|
224
|
+
backgroundColor={item.active ? 'color.blue.600' : 'transparent'}
|
|
225
|
+
cursor="pointer"
|
|
226
|
+
_hover={{
|
|
227
|
+
backgroundColor: item.active ? 'color.blue.600' : 'color.gray.800'
|
|
228
|
+
}}
|
|
229
|
+
>
|
|
230
|
+
<item.icon
|
|
231
|
+
widthHeight={20}
|
|
232
|
+
color={item.active ? 'color.white' : 'color.gray.300'}
|
|
233
|
+
/>
|
|
234
|
+
<Text
|
|
235
|
+
color={item.active ? 'color.white' : 'color.gray.300'}
|
|
236
|
+
fontWeight={item.active ? 'medium' : 'normal'}
|
|
237
|
+
>
|
|
238
|
+
{item.label}
|
|
239
|
+
</Text>
|
|
240
|
+
</Horizontal>
|
|
241
|
+
))}
|
|
242
|
+
</Vertical>
|
|
243
|
+
|
|
244
|
+
<View flex={1} />
|
|
245
|
+
|
|
246
|
+
<Horizontal
|
|
247
|
+
alignItems="center"
|
|
248
|
+
gap={12}
|
|
249
|
+
padding={12}
|
|
250
|
+
borderRadius={8}
|
|
251
|
+
cursor="pointer"
|
|
252
|
+
_hover={{ backgroundColor: 'color.gray.800' }}
|
|
253
|
+
>
|
|
254
|
+
<LogoutIcon widthHeight={20} color="color.gray.300" />
|
|
255
|
+
<Text color="color.gray.300">Logout</Text>
|
|
256
|
+
</Horizontal>
|
|
257
|
+
</Vertical>
|
|
258
|
+
);
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
### **Card Layout Example**
|
|
262
|
+
```tsx
|
|
263
|
+
import React from 'react';
|
|
264
|
+
import { Vertical } from 'app-studio';
|
|
265
|
+
import { View, Text, Horizontal } from 'app-studio';
|
|
266
|
+
import { Button } from '@app-studio/web';
|
|
267
|
+
import { StarIcon, HeartIcon, ShareIcon } from '@app-studio/web';
|
|
268
|
+
|
|
269
|
+
export const CardLayout = () => (
|
|
270
|
+
<Vertical gap={24} padding={24}>
|
|
271
|
+
{[1, 2, 3].map((item) => (
|
|
272
|
+
<View
|
|
273
|
+
key={item}
|
|
274
|
+
border="1px solid"
|
|
275
|
+
borderColor="color.gray.200"
|
|
276
|
+
borderRadius={12}
|
|
277
|
+
overflow="hidden"
|
|
278
|
+
backgroundColor="color.white"
|
|
279
|
+
boxShadow="0 2px 8px rgba(0,0,0,0.1)"
|
|
280
|
+
>
|
|
281
|
+
<View
|
|
282
|
+
height={200}
|
|
283
|
+
backgroundColor="color.blue.100"
|
|
284
|
+
backgroundImage={`url(https://picsum.photos/400/200?random=${item})`}
|
|
285
|
+
backgroundSize="cover"
|
|
286
|
+
backgroundPosition="center"
|
|
287
|
+
/>
|
|
288
|
+
|
|
289
|
+
<Vertical gap={16} padding={20}>
|
|
290
|
+
<Vertical gap={8}>
|
|
291
|
+
<Text fontSize={20} fontWeight="bold">
|
|
292
|
+
Article Title {item}
|
|
293
|
+
</Text>
|
|
294
|
+
<Text color="color.gray.600" lineHeight={1.6}>
|
|
295
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
|
296
|
+
Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
|
297
|
+
</Text>
|
|
298
|
+
</Vertical>
|
|
299
|
+
|
|
300
|
+
<Horizontal justifyContent="space-between" alignItems="center">
|
|
301
|
+
<Horizontal gap={16}>
|
|
302
|
+
<Horizontal alignItems="center" gap={4}>
|
|
303
|
+
<StarIcon widthHeight={16} color="color.yellow.500" />
|
|
304
|
+
<Text fontSize={14} color="color.gray.600">4.5</Text>
|
|
305
|
+
</Horizontal>
|
|
306
|
+
<Horizontal alignItems="center" gap={4}>
|
|
307
|
+
<HeartIcon widthHeight={16} color="color.red.500" />
|
|
308
|
+
<Text fontSize={14} color="color.gray.600">24</Text>
|
|
309
|
+
</Horizontal>
|
|
310
|
+
<ShareIcon widthHeight={16} color="color.gray.400" />
|
|
311
|
+
</Horizontal>
|
|
312
|
+
|
|
313
|
+
<Button variant="outline" size="sm">
|
|
314
|
+
Read More
|
|
315
|
+
</Button>
|
|
316
|
+
</Horizontal>
|
|
317
|
+
</Vertical>
|
|
318
|
+
</View>
|
|
319
|
+
))}
|
|
320
|
+
</Vertical>
|
|
321
|
+
);
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
### **Props**
|
|
325
|
+
|
|
326
|
+
The Vertical component extends ViewProps from app-studio, inheriting all standard view properties:
|
|
327
|
+
|
|
328
|
+
| Prop | Type | Default | Description |
|
|
329
|
+
| ---- | ---- | ------- | ----------- |
|
|
330
|
+
| gap | number \| string | 0 | Space between child elements |
|
|
331
|
+
| alignItems | FlexAlign | 'stretch' | Cross-axis alignment of children |
|
|
332
|
+
| justifyContent | FlexJustify | 'flex-start' | Main-axis alignment of children |
|
|
333
|
+
| wrap | FlexWrap | 'nowrap' | Whether children should wrap |
|
|
334
|
+
| children | React.ReactNode | undefined | Child elements to arrange vertically |
|
|
335
|
+
|
|
336
|
+
**Inherited ViewProps:**
|
|
337
|
+
- `width`, `height`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`
|
|
338
|
+
- `padding`, `margin`, `paddingTop`, `paddingBottom`, etc.
|
|
339
|
+
- `backgroundColor`, `border`, `borderRadius`, `boxShadow`
|
|
340
|
+
- `position`, `top`, `left`, `right`, `bottom`, `zIndex`
|
|
341
|
+
- `overflow`, `cursor`, `opacity`, `transform`
|
|
342
|
+
- All CSS properties and responsive breakpoint props
|
|
343
|
+
|
|
344
|
+
### **Responsive Design**
|
|
345
|
+
```tsx
|
|
346
|
+
import React from 'react';
|
|
347
|
+
import { Vertical } from 'app-studio';
|
|
348
|
+
import { View, Text } from 'app-studio';
|
|
349
|
+
|
|
350
|
+
export const ResponsiveVertical = () => (
|
|
351
|
+
<Vertical
|
|
352
|
+
gap={{ mobile: 8, tablet: 16, desktop: 24 }}
|
|
353
|
+
padding={{ mobile: 16, tablet: 24, desktop: 32 }}
|
|
354
|
+
alignItems={{ mobile: 'stretch', desktop: 'center' }}
|
|
355
|
+
>
|
|
356
|
+
<View
|
|
357
|
+
width={{ mobile: '100%', tablet: '80%', desktop: '60%' }}
|
|
358
|
+
height={100}
|
|
359
|
+
backgroundColor="color.blue.200"
|
|
360
|
+
/>
|
|
361
|
+
<View
|
|
362
|
+
width={{ mobile: '100%', tablet: '80%', desktop: '60%' }}
|
|
363
|
+
height={100}
|
|
364
|
+
backgroundColor="color.green.200"
|
|
365
|
+
/>
|
|
366
|
+
<View
|
|
367
|
+
width={{ mobile: '100%', tablet: '80%', desktop: '60%' }}
|
|
368
|
+
height={100}
|
|
369
|
+
backgroundColor="color.purple.200"
|
|
370
|
+
/>
|
|
371
|
+
</Vertical>
|
|
372
|
+
);
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
### **Advanced Layout Patterns**
|
|
376
|
+
|
|
377
|
+
**Sticky Header with Scrollable Content:**
|
|
378
|
+
```tsx
|
|
379
|
+
import React from 'react';
|
|
380
|
+
import { Vertical } from 'app-studio';
|
|
381
|
+
import { View, Text } from 'app-studio';
|
|
382
|
+
|
|
383
|
+
export const StickyHeaderLayout = () => (
|
|
384
|
+
<Vertical height="100vh">
|
|
385
|
+
{/* Sticky Header */}
|
|
386
|
+
<View
|
|
387
|
+
padding={16}
|
|
388
|
+
backgroundColor="color.white"
|
|
389
|
+
borderBottom="1px solid"
|
|
390
|
+
borderColor="color.gray.200"
|
|
391
|
+
position="sticky"
|
|
392
|
+
top={0}
|
|
393
|
+
zIndex={10}
|
|
394
|
+
>
|
|
395
|
+
<Text fontSize={20} fontWeight="bold">
|
|
396
|
+
Header
|
|
397
|
+
</Text>
|
|
398
|
+
</View>
|
|
399
|
+
|
|
400
|
+
{/* Scrollable Content */}
|
|
401
|
+
<Vertical flex={1} overflow="auto" padding={16} gap={16}>
|
|
402
|
+
{Array.from({ length: 50 }, (_, i) => (
|
|
403
|
+
<View
|
|
404
|
+
key={i}
|
|
405
|
+
padding={16}
|
|
406
|
+
backgroundColor="color.gray.50"
|
|
407
|
+
borderRadius={8}
|
|
408
|
+
>
|
|
409
|
+
<Text>Content Item {i + 1}</Text>
|
|
410
|
+
</View>
|
|
411
|
+
))}
|
|
412
|
+
</Vertical>
|
|
413
|
+
</Vertical>
|
|
414
|
+
);
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
**Split Layout:**
|
|
418
|
+
```tsx
|
|
419
|
+
import React from 'react';
|
|
420
|
+
import { Vertical, Horizontal } from 'app-studio';
|
|
421
|
+
import { View, Text } from 'app-studio';
|
|
422
|
+
|
|
423
|
+
export const SplitLayout = () => (
|
|
424
|
+
<Horizontal height="100vh">
|
|
425
|
+
{/* Sidebar */}
|
|
426
|
+
<Vertical
|
|
427
|
+
width={250}
|
|
428
|
+
backgroundColor="color.gray.100"
|
|
429
|
+
padding={16}
|
|
430
|
+
gap={8}
|
|
431
|
+
>
|
|
432
|
+
<Text fontWeight="bold">Sidebar</Text>
|
|
433
|
+
{['Item 1', 'Item 2', 'Item 3'].map((item) => (
|
|
434
|
+
<View key={item} padding={8}>
|
|
435
|
+
<Text>{item}</Text>
|
|
436
|
+
</View>
|
|
437
|
+
))}
|
|
438
|
+
</Vertical>
|
|
439
|
+
|
|
440
|
+
{/* Main Content */}
|
|
441
|
+
<Vertical flex={1} padding={24} gap={16}>
|
|
442
|
+
<Text fontSize={24} fontWeight="bold">
|
|
443
|
+
Main Content
|
|
444
|
+
</Text>
|
|
445
|
+
<View
|
|
446
|
+
flex={1}
|
|
447
|
+
backgroundColor="color.white"
|
|
448
|
+
border="1px solid"
|
|
449
|
+
borderColor="color.gray.200"
|
|
450
|
+
borderRadius={8}
|
|
451
|
+
padding={24}
|
|
452
|
+
>
|
|
453
|
+
<Text>Content area</Text>
|
|
454
|
+
</View>
|
|
455
|
+
</Vertical>
|
|
456
|
+
</Horizontal>
|
|
457
|
+
);
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
### **Best Practices**
|
|
461
|
+
|
|
462
|
+
**Spacing:**
|
|
463
|
+
- Use consistent gap values throughout your application
|
|
464
|
+
- Consider using a spacing scale (4, 8, 12, 16, 20, 24, 32, 40, 48, 64)
|
|
465
|
+
- Use responsive gap values for different screen sizes
|
|
466
|
+
|
|
467
|
+
**Alignment:**
|
|
468
|
+
- Use `alignItems="stretch"` for full-width children
|
|
469
|
+
- Use `alignItems="center"` for centered content
|
|
470
|
+
- Use `justifyContent="space-between"` for distributed spacing
|
|
471
|
+
|
|
472
|
+
**Performance:**
|
|
473
|
+
- Avoid deeply nested Vertical components when possible
|
|
474
|
+
- Use CSS Grid for complex layouts instead of multiple nested flex containers
|
|
475
|
+
- Consider virtualization for long lists
|
|
476
|
+
|
|
477
|
+
**Accessibility:**
|
|
478
|
+
- Use semantic HTML elements when appropriate
|
|
479
|
+
- Ensure proper heading hierarchy in vertical layouts
|
|
480
|
+
- Maintain logical tab order for keyboard navigation
|
|
481
|
+
|
|
482
|
+
### **Common Patterns**
|
|
483
|
+
|
|
484
|
+
**Form Section:**
|
|
485
|
+
```tsx
|
|
486
|
+
<Vertical gap={24}>
|
|
487
|
+
<Text fontSize={18} fontWeight="bold">Personal Information</Text>
|
|
488
|
+
<Vertical gap={16}>
|
|
489
|
+
<TextField label="First Name" />
|
|
490
|
+
<TextField label="Last Name" />
|
|
491
|
+
<TextField label="Email" />
|
|
492
|
+
</Vertical>
|
|
493
|
+
</Vertical>
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
**Feature List:**
|
|
497
|
+
```tsx
|
|
498
|
+
<Vertical gap={16}>
|
|
499
|
+
{features.map((feature) => (
|
|
500
|
+
<Horizontal key={feature.id} gap={12} alignItems="flex-start">
|
|
501
|
+
<CheckIcon widthHeight={20} color="color.green.500" />
|
|
502
|
+
<Vertical gap={4}>
|
|
503
|
+
<Text fontWeight="medium">{feature.title}</Text>
|
|
504
|
+
<Text color="color.gray.600">{feature.description}</Text>
|
|
505
|
+
</Vertical>
|
|
506
|
+
</Horizontal>
|
|
507
|
+
))}
|
|
508
|
+
</Vertical>
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
**Timeline:**
|
|
512
|
+
```tsx
|
|
513
|
+
<Vertical gap={24}>
|
|
514
|
+
{timelineItems.map((item, index) => (
|
|
515
|
+
<Horizontal key={item.id} gap={16}>
|
|
516
|
+
<Vertical alignItems="center">
|
|
517
|
+
<View
|
|
518
|
+
width={12}
|
|
519
|
+
height={12}
|
|
520
|
+
borderRadius="50%"
|
|
521
|
+
backgroundColor="color.blue.500"
|
|
522
|
+
/>
|
|
523
|
+
{index < timelineItems.length - 1 && (
|
|
524
|
+
<View
|
|
525
|
+
width={2}
|
|
526
|
+
height={40}
|
|
527
|
+
backgroundColor="color.gray.300"
|
|
528
|
+
marginTop={8}
|
|
529
|
+
/>
|
|
530
|
+
)}
|
|
531
|
+
</Vertical>
|
|
532
|
+
<Vertical gap={4} flex={1}>
|
|
533
|
+
<Text fontWeight="medium">{item.title}</Text>
|
|
534
|
+
<Text color="color.gray.600">{item.description}</Text>
|
|
535
|
+
<Text fontSize={12} color="color.gray.500">{item.date}</Text>
|
|
536
|
+
</Vertical>
|
|
537
|
+
</Horizontal>
|
|
538
|
+
))}
|
|
539
|
+
</Vertical>
|
|
540
|
+
```
|
|
541
|
+
|
|
542
|
+
### **Integration with Other Components**
|
|
543
|
+
|
|
544
|
+
The Vertical component works seamlessly with other layout components:
|
|
545
|
+
|
|
546
|
+
```tsx
|
|
547
|
+
import { Vertical, Horizontal, Center } from 'app-studio';
|
|
548
|
+
|
|
549
|
+
// Nested layouts
|
|
550
|
+
<Vertical gap={20}>
|
|
551
|
+
<Horizontal justifyContent="space-between">
|
|
552
|
+
<Text>Header</Text>
|
|
553
|
+
<Button>Action</Button>
|
|
554
|
+
</Horizontal>
|
|
555
|
+
|
|
556
|
+
<Center height={200}>
|
|
557
|
+
<Text>Centered Content</Text>
|
|
558
|
+
</Center>
|
|
559
|
+
|
|
560
|
+
<Horizontal gap={12}>
|
|
561
|
+
<Button variant="outline">Cancel</Button>
|
|
562
|
+
<Button variant="filled">Save</Button>
|
|
563
|
+
</Horizontal>
|
|
564
|
+
</Vertical>
|
|
565
|
+
```
|
|
566
|
+
|