@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,438 @@
|
|
|
1
|
+
# Label
|
|
2
|
+
|
|
3
|
+
A semantic text element designed for form labels and descriptive text with comprehensive typography options, accessibility features, and flexible styling. Perfect for form fields, section headers, and any text that needs semantic meaning.
|
|
4
|
+
|
|
5
|
+
### **Import**
|
|
6
|
+
```tsx
|
|
7
|
+
import { Label } from '@app-studio/web';
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
### **Basic Usage**
|
|
11
|
+
```tsx
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import { Label } from '@app-studio/web';
|
|
14
|
+
import { TextField } from '@app-studio/web';
|
|
15
|
+
import { Vertical } from 'app-studio';
|
|
16
|
+
|
|
17
|
+
export const BasicLabel = () => (
|
|
18
|
+
<Vertical gap={8}>
|
|
19
|
+
<Label>Email Address</Label>
|
|
20
|
+
<TextField placeholder="Enter your email" />
|
|
21
|
+
</Vertical>
|
|
22
|
+
);
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### **Label Sizes**
|
|
26
|
+
```tsx
|
|
27
|
+
import React from 'react';
|
|
28
|
+
import { Label } from '@app-studio/web';
|
|
29
|
+
import { Vertical } from 'app-studio';
|
|
30
|
+
|
|
31
|
+
export const LabelSizes = () => (
|
|
32
|
+
<Vertical gap={16}>
|
|
33
|
+
<Label size="xs">Extra Small Label</Label>
|
|
34
|
+
<Label size="sm">Small Label</Label>
|
|
35
|
+
<Label size="md">Medium Label (Default)</Label>
|
|
36
|
+
<Label size="lg">Large Label</Label>
|
|
37
|
+
<Label size="xl">Extra Large Label</Label>
|
|
38
|
+
</Vertical>
|
|
39
|
+
);
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### **Label Weights**
|
|
43
|
+
```tsx
|
|
44
|
+
import React from 'react';
|
|
45
|
+
import { Label } from '@app-studio/web';
|
|
46
|
+
import { Vertical } from 'app-studio';
|
|
47
|
+
|
|
48
|
+
export const LabelWeights = () => (
|
|
49
|
+
<Vertical gap={12}>
|
|
50
|
+
<Label weight="light">Light Weight Label</Label>
|
|
51
|
+
<Label weight="normal">Normal Weight Label</Label>
|
|
52
|
+
<Label weight="medium">Medium Weight Label</Label>
|
|
53
|
+
<Label weight="semibold">Semibold Weight Label</Label>
|
|
54
|
+
<Label weight="bold">Bold Weight Label</Label>
|
|
55
|
+
</Vertical>
|
|
56
|
+
);
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### **Heading Labels**
|
|
60
|
+
```tsx
|
|
61
|
+
import React from 'react';
|
|
62
|
+
import { Label } from '@app-studio/web';
|
|
63
|
+
import { Vertical } from 'app-studio';
|
|
64
|
+
|
|
65
|
+
export const HeadingLabels = () => (
|
|
66
|
+
<Vertical gap={16}>
|
|
67
|
+
<Label heading="h1">Heading 1 Label</Label>
|
|
68
|
+
<Label heading="h2">Heading 2 Label</Label>
|
|
69
|
+
<Label heading="h3">Heading 3 Label</Label>
|
|
70
|
+
<Label heading="h4">Heading 4 Label</Label>
|
|
71
|
+
<Label heading="h5">Heading 5 Label</Label>
|
|
72
|
+
<Label heading="h6">Heading 6 Label</Label>
|
|
73
|
+
</Vertical>
|
|
74
|
+
);
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### **Text Decorations**
|
|
78
|
+
```tsx
|
|
79
|
+
import React from 'react';
|
|
80
|
+
import { Label } from '@app-studio/web';
|
|
81
|
+
import { Vertical } from 'app-studio';
|
|
82
|
+
|
|
83
|
+
export const TextDecorations = () => (
|
|
84
|
+
<Vertical gap={12}>
|
|
85
|
+
<Label>Normal Text</Label>
|
|
86
|
+
<Label isItalic>Italic Text</Label>
|
|
87
|
+
<Label isUnderlined>Underlined Text</Label>
|
|
88
|
+
<Label isStriked>Strikethrough Text</Label>
|
|
89
|
+
<Label isItalic isUnderlined weight="bold">
|
|
90
|
+
Combined Styles
|
|
91
|
+
</Label>
|
|
92
|
+
</Vertical>
|
|
93
|
+
);
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### **Form Labels with Required Indicators**
|
|
97
|
+
```tsx
|
|
98
|
+
import React from 'react';
|
|
99
|
+
import { Label } from '@app-studio/web';
|
|
100
|
+
import { TextField, TextArea } from '@app-studio/web';
|
|
101
|
+
import { Vertical, Horizontal } from 'app-studio';
|
|
102
|
+
|
|
103
|
+
export const FormLabels = () => (
|
|
104
|
+
<Vertical gap={20}>
|
|
105
|
+
<Vertical gap={8}>
|
|
106
|
+
<Horizontal alignItems="center" gap={4}>
|
|
107
|
+
<Label weight="medium">Full Name</Label>
|
|
108
|
+
<Label color="color.red.500" size="sm">*</Label>
|
|
109
|
+
</Horizontal>
|
|
110
|
+
<TextField placeholder="Enter your full name" required />
|
|
111
|
+
</Vertical>
|
|
112
|
+
|
|
113
|
+
<Vertical gap={8}>
|
|
114
|
+
<Horizontal alignItems="center" gap={4}>
|
|
115
|
+
<Label weight="medium">Email Address</Label>
|
|
116
|
+
<Label color="color.red.500" size="sm">*</Label>
|
|
117
|
+
</Horizontal>
|
|
118
|
+
<TextField type="email" placeholder="Enter your email" required />
|
|
119
|
+
</Vertical>
|
|
120
|
+
|
|
121
|
+
<Vertical gap={8}>
|
|
122
|
+
<Label weight="medium">Additional Comments</Label>
|
|
123
|
+
<Label size="sm" color="color.gray.600">Optional</Label>
|
|
124
|
+
<TextArea placeholder="Enter any additional comments" rows={3} />
|
|
125
|
+
</Vertical>
|
|
126
|
+
</Vertical>
|
|
127
|
+
);
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### **Section Headers**
|
|
131
|
+
```tsx
|
|
132
|
+
import React from 'react';
|
|
133
|
+
import { Label } from '@app-studio/web';
|
|
134
|
+
import { View, Vertical } from 'app-studio';
|
|
135
|
+
|
|
136
|
+
export const SectionHeaders = () => (
|
|
137
|
+
<Vertical gap={24}>
|
|
138
|
+
<View>
|
|
139
|
+
<Label heading="h2" weight="bold" marginBottom={8}>
|
|
140
|
+
Personal Information
|
|
141
|
+
</Label>
|
|
142
|
+
<View height={1} backgroundColor="color.gray.200" marginBottom={16} />
|
|
143
|
+
<Label color="color.gray.600">
|
|
144
|
+
Please provide your personal details below.
|
|
145
|
+
</Label>
|
|
146
|
+
</View>
|
|
147
|
+
|
|
148
|
+
<View>
|
|
149
|
+
<Label heading="h2" weight="bold" marginBottom={8}>
|
|
150
|
+
Contact Details
|
|
151
|
+
</Label>
|
|
152
|
+
<View height={1} backgroundColor="color.gray.200" marginBottom={16} />
|
|
153
|
+
<Label color="color.gray.600">
|
|
154
|
+
How can we reach you?
|
|
155
|
+
</Label>
|
|
156
|
+
</View>
|
|
157
|
+
|
|
158
|
+
<View>
|
|
159
|
+
<Label heading="h2" weight="bold" marginBottom={8}>
|
|
160
|
+
Preferences
|
|
161
|
+
</Label>
|
|
162
|
+
<View height={1} backgroundColor="color.gray.200" marginBottom={16} />
|
|
163
|
+
<Label color="color.gray.600">
|
|
164
|
+
Customize your experience.
|
|
165
|
+
</Label>
|
|
166
|
+
</View>
|
|
167
|
+
</Vertical>
|
|
168
|
+
);
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### **Colored Labels**
|
|
172
|
+
```tsx
|
|
173
|
+
import React from 'react';
|
|
174
|
+
import { Label } from '@app-studio/web';
|
|
175
|
+
import { Vertical } from 'app-studio';
|
|
176
|
+
|
|
177
|
+
export const ColoredLabels = () => (
|
|
178
|
+
<Vertical gap={12}>
|
|
179
|
+
<Label color="color.blue.600">Primary Label</Label>
|
|
180
|
+
<Label color="color.green.600">Success Label</Label>
|
|
181
|
+
<Label color="color.yellow.600">Warning Label</Label>
|
|
182
|
+
<Label color="color.red.600">Error Label</Label>
|
|
183
|
+
<Label color="color.gray.600">Muted Label</Label>
|
|
184
|
+
<Label color="theme.primary">Theme Primary</Label>
|
|
185
|
+
<Label color="theme.secondary">Theme Secondary</Label>
|
|
186
|
+
</Vertical>
|
|
187
|
+
);
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### **Props**
|
|
191
|
+
|
|
192
|
+
| Prop | Type | Default | Description |
|
|
193
|
+
| ---- | ---- | ------- | ----------- |
|
|
194
|
+
| children | React.ReactNode | required | The text content of the label |
|
|
195
|
+
| heading | `'h1' \| 'h2' \| 'h3' \| 'h4' \| 'h5' \| 'h6'` | undefined | Renders as a heading element with appropriate styling |
|
|
196
|
+
| size | `'xs' \| 'sm' \| 'md' \| 'lg' \| 'xl'` | 'sm' | Font size of the label |
|
|
197
|
+
| weight | `'light' \| 'normal' \| 'medium' \| 'semibold' \| 'bold'` | 'normal' | Font weight of the label |
|
|
198
|
+
| isItalic | boolean | false | Whether the text should be italic |
|
|
199
|
+
| isUnderlined | boolean | false | Whether the text should be underlined |
|
|
200
|
+
| isStriked | boolean | false | Whether the text should have strikethrough |
|
|
201
|
+
| color | string | undefined | Text color (supports theme colors) |
|
|
202
|
+
| className | string | undefined | CSS class name |
|
|
203
|
+
|
|
204
|
+
**Inherited ViewProps:**
|
|
205
|
+
- All standard view properties like `margin`, `padding`, `width`, `height`
|
|
206
|
+
- Color properties like `backgroundColor`, `borderColor`
|
|
207
|
+
- Layout properties like `display`, `position`, `flex`
|
|
208
|
+
- Responsive breakpoint props
|
|
209
|
+
|
|
210
|
+
### **Accessibility Features**
|
|
211
|
+
|
|
212
|
+
**Semantic HTML:**
|
|
213
|
+
```tsx
|
|
214
|
+
// Renders as <label> element by default
|
|
215
|
+
<Label htmlFor="email-input">Email Address</Label>
|
|
216
|
+
<input id="email-input" type="email" />
|
|
217
|
+
|
|
218
|
+
// Renders as heading elements when heading prop is used
|
|
219
|
+
<Label heading="h2">Section Title</Label> // renders as <h2>
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
**Screen Reader Support:**
|
|
223
|
+
```tsx
|
|
224
|
+
<Label
|
|
225
|
+
aria-label="Required field"
|
|
226
|
+
aria-describedby="email-help"
|
|
227
|
+
>
|
|
228
|
+
Email Address *
|
|
229
|
+
</Label>
|
|
230
|
+
<input
|
|
231
|
+
id="email-input"
|
|
232
|
+
type="email"
|
|
233
|
+
aria-describedby="email-help"
|
|
234
|
+
/>
|
|
235
|
+
<Label id="email-help" size="sm" color="color.gray.600">
|
|
236
|
+
We'll never share your email with anyone else.
|
|
237
|
+
</Label>
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
### **Advanced Usage**
|
|
241
|
+
|
|
242
|
+
**Custom Styling:**
|
|
243
|
+
```tsx
|
|
244
|
+
import React from 'react';
|
|
245
|
+
import { Label } from '@app-studio/web';
|
|
246
|
+
|
|
247
|
+
export const CustomStyledLabel = () => (
|
|
248
|
+
<Label
|
|
249
|
+
weight="bold"
|
|
250
|
+
color="color.blue.600"
|
|
251
|
+
textTransform="uppercase"
|
|
252
|
+
letterSpacing="0.05em"
|
|
253
|
+
borderBottom="2px solid"
|
|
254
|
+
borderColor="color.blue.600"
|
|
255
|
+
paddingBottom={4}
|
|
256
|
+
display="inline-block"
|
|
257
|
+
>
|
|
258
|
+
Custom Styled Label
|
|
259
|
+
</Label>
|
|
260
|
+
);
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
**Responsive Labels:**
|
|
264
|
+
```tsx
|
|
265
|
+
import React from 'react';
|
|
266
|
+
import { Label } from '@app-studio/web';
|
|
267
|
+
|
|
268
|
+
export const ResponsiveLabel = () => (
|
|
269
|
+
<Label
|
|
270
|
+
size={{ mobile: 'sm', tablet: 'md', desktop: 'lg' }}
|
|
271
|
+
weight={{ mobile: 'normal', desktop: 'bold' }}
|
|
272
|
+
color={{ mobile: 'color.gray.700', desktop: 'color.blue.600' }}
|
|
273
|
+
>
|
|
274
|
+
Responsive Label
|
|
275
|
+
</Label>
|
|
276
|
+
);
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
**Interactive Labels:**
|
|
280
|
+
```tsx
|
|
281
|
+
import React, { useState } from 'react';
|
|
282
|
+
import { Label } from '@app-studio/web';
|
|
283
|
+
|
|
284
|
+
export const InteractiveLabel = () => {
|
|
285
|
+
const [isActive, setIsActive] = useState(false);
|
|
286
|
+
|
|
287
|
+
return (
|
|
288
|
+
<Label
|
|
289
|
+
cursor="pointer"
|
|
290
|
+
color={isActive ? 'color.blue.600' : 'color.gray.700'}
|
|
291
|
+
weight={isActive ? 'bold' : 'normal'}
|
|
292
|
+
onClick={() => setIsActive(!isActive)}
|
|
293
|
+
transition="all 0.2s ease"
|
|
294
|
+
_hover={{
|
|
295
|
+
color: 'color.blue.600',
|
|
296
|
+
}}
|
|
297
|
+
>
|
|
298
|
+
Click me to toggle
|
|
299
|
+
</Label>
|
|
300
|
+
);
|
|
301
|
+
};
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
### **Best Practices**
|
|
305
|
+
|
|
306
|
+
**Form Labels:**
|
|
307
|
+
- Always associate labels with form controls using `htmlFor` or by wrapping
|
|
308
|
+
- Use clear, descriptive text
|
|
309
|
+
- Indicate required fields consistently
|
|
310
|
+
- Provide helpful context when needed
|
|
311
|
+
|
|
312
|
+
**Typography:**
|
|
313
|
+
- Use consistent sizing throughout your application
|
|
314
|
+
- Maintain proper heading hierarchy (h1 → h2 → h3, etc.)
|
|
315
|
+
- Choose appropriate font weights for emphasis
|
|
316
|
+
- Ensure sufficient color contrast for accessibility
|
|
317
|
+
|
|
318
|
+
**Semantic Usage:**
|
|
319
|
+
- Use heading props for actual section headings
|
|
320
|
+
- Use regular labels for form fields and descriptions
|
|
321
|
+
- Consider the document outline and screen reader experience
|
|
322
|
+
|
|
323
|
+
### **Common Patterns**
|
|
324
|
+
|
|
325
|
+
**Field Group Label:**
|
|
326
|
+
```tsx
|
|
327
|
+
<Vertical gap={16}>
|
|
328
|
+
<Label heading="h3" weight="bold">
|
|
329
|
+
Billing Address
|
|
330
|
+
</Label>
|
|
331
|
+
<Vertical gap={12}>
|
|
332
|
+
<Vertical gap={4}>
|
|
333
|
+
<Label>Street Address</Label>
|
|
334
|
+
<TextField />
|
|
335
|
+
</Vertical>
|
|
336
|
+
<Horizontal gap={12}>
|
|
337
|
+
<Vertical gap={4} flex={1}>
|
|
338
|
+
<Label>City</Label>
|
|
339
|
+
<TextField />
|
|
340
|
+
</Vertical>
|
|
341
|
+
<Vertical gap={4} flex={1}>
|
|
342
|
+
<Label>ZIP Code</Label>
|
|
343
|
+
<TextField />
|
|
344
|
+
</Vertical>
|
|
345
|
+
</Horizontal>
|
|
346
|
+
</Vertical>
|
|
347
|
+
</Vertical>
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
**Status Labels:**
|
|
351
|
+
```tsx
|
|
352
|
+
const StatusLabel = ({ status, children }) => {
|
|
353
|
+
const colors = {
|
|
354
|
+
active: 'color.green.600',
|
|
355
|
+
pending: 'color.yellow.600',
|
|
356
|
+
inactive: 'color.red.600',
|
|
357
|
+
};
|
|
358
|
+
|
|
359
|
+
return (
|
|
360
|
+
<Label
|
|
361
|
+
color={colors[status]}
|
|
362
|
+
weight="medium"
|
|
363
|
+
textTransform="uppercase"
|
|
364
|
+
fontSize="xs"
|
|
365
|
+
>
|
|
366
|
+
{children}
|
|
367
|
+
</Label>
|
|
368
|
+
);
|
|
369
|
+
};
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
**Help Text:**
|
|
373
|
+
```tsx
|
|
374
|
+
<Vertical gap={4}>
|
|
375
|
+
<Label weight="medium">Password</Label>
|
|
376
|
+
<TextField type="password" />
|
|
377
|
+
<Label size="sm" color="color.gray.600">
|
|
378
|
+
Must be at least 8 characters with uppercase, lowercase, and numbers
|
|
379
|
+
</Label>
|
|
380
|
+
</Vertical>
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
### **Integration Examples**
|
|
384
|
+
|
|
385
|
+
**With Form Components:**
|
|
386
|
+
```tsx
|
|
387
|
+
import { FormikForm, FormikTextField } from '@app-studio/web';
|
|
388
|
+
|
|
389
|
+
<FormikForm>
|
|
390
|
+
<Vertical gap={16}>
|
|
391
|
+
<Vertical gap={4}>
|
|
392
|
+
<Label htmlFor="username">Username</Label>
|
|
393
|
+
<FormikTextField
|
|
394
|
+
id="username"
|
|
395
|
+
name="username"
|
|
396
|
+
placeholder="Enter username"
|
|
397
|
+
/>
|
|
398
|
+
</Vertical>
|
|
399
|
+
</Vertical>
|
|
400
|
+
</FormikForm>
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
**With Card Components:**
|
|
404
|
+
```tsx
|
|
405
|
+
import { Card } from '@app-studio/web';
|
|
406
|
+
|
|
407
|
+
<Card>
|
|
408
|
+
<Card.Header>
|
|
409
|
+
<Label heading="h3" weight="bold">
|
|
410
|
+
Card Title
|
|
411
|
+
</Label>
|
|
412
|
+
</Card.Header>
|
|
413
|
+
<Card.Body>
|
|
414
|
+
<Label color="color.gray.600">
|
|
415
|
+
Card description text
|
|
416
|
+
</Label>
|
|
417
|
+
</Card.Body>
|
|
418
|
+
</Card>
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
**With Navigation:**
|
|
422
|
+
```tsx
|
|
423
|
+
import { NavigationMenu } from '@app-studio/web';
|
|
424
|
+
|
|
425
|
+
<NavigationMenu>
|
|
426
|
+
<NavigationMenu.Section>
|
|
427
|
+
<Label
|
|
428
|
+
size="xs"
|
|
429
|
+
weight="bold"
|
|
430
|
+
color="color.gray.500"
|
|
431
|
+
textTransform="uppercase"
|
|
432
|
+
letterSpacing="0.05em"
|
|
433
|
+
>
|
|
434
|
+
Main Navigation
|
|
435
|
+
</Label>
|
|
436
|
+
</NavigationMenu.Section>
|
|
437
|
+
</NavigationMenu>
|
|
438
|
+
```
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Link
|
|
2
|
+
|
|
3
|
+
Enables users to navigate to specified URLs or paths.
|
|
4
|
+
|
|
5
|
+
### **Import**
|
|
6
|
+
```tsx
|
|
7
|
+
import { Link } from '@app-studio/web';
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
### **Default**
|
|
11
|
+
```tsx
|
|
12
|
+
import React from 'react';
|
|
13
|
+
|
|
14
|
+
import { Link } from '../Link';
|
|
15
|
+
|
|
16
|
+
export const DefaultLink = () => <Link href="/">Default</Link>;
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### **underline**
|
|
21
|
+
Optional prop to define the text decoration style of the link as underline views.
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import React from 'react';
|
|
25
|
+
import { Text } from '../../Text/Text';
|
|
26
|
+
import { Vertical } from 'app-studio';
|
|
27
|
+
|
|
28
|
+
import { Link } from '../Link';
|
|
29
|
+
|
|
30
|
+
export const UnderlineLink = () => (
|
|
31
|
+
<Vertical gap={10}>
|
|
32
|
+
<Link href={'https://www.npmjs.com/package/app-studio'} underline="default">
|
|
33
|
+
Default
|
|
34
|
+
</Link>
|
|
35
|
+
<Link href={'https://www.npmjs.com/package/app-studio'} underline="hover">
|
|
36
|
+
Hover
|
|
37
|
+
</Link>
|
|
38
|
+
<Link
|
|
39
|
+
href={'https://www.npmjs.com/package/app-studio'}
|
|
40
|
+
underline="underline"
|
|
41
|
+
color="theme.primary"
|
|
42
|
+
textDecorationColor="theme.primary"
|
|
43
|
+
>
|
|
44
|
+
<Text>Underline</Text>
|
|
45
|
+
</Link>
|
|
46
|
+
</Vertical>
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### **isExternal**
|
|
52
|
+
Optional boolean indicating whether the link points to an external resource. Default behavior may vary based on this value.
|
|
53
|
+
|
|
54
|
+
```tsx
|
|
55
|
+
import React from 'react';
|
|
56
|
+
import { Text } from '../../Text/Text';
|
|
57
|
+
|
|
58
|
+
import { Link } from '../Link';
|
|
59
|
+
|
|
60
|
+
export const ExternalLink = () => (
|
|
61
|
+
<Link
|
|
62
|
+
href={'https://www.npmjs.com/package/app-studio'}
|
|
63
|
+
isExternal
|
|
64
|
+
iconSize="md"
|
|
65
|
+
>
|
|
66
|
+
<Text size="xl">External</Text>
|
|
67
|
+
</Link>
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Props
|
|
73
|
+
|
|
74
|
+
| Prop | Type | Description | Default |
|
|
75
|
+
| ------------------ | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ------- |
|
|
76
|
+
| href | string | The URL or path the link points to. | |
|
|
77
|
+
| underline | string | The text decoration style of the link ('default', 'hover', 'underline'). | |
|
|
78
|
+
| isExternal | boolean | Whether the link points to an external resource. | false |
|
|
79
|
+
| iconSize | Size | The size of the icon if the link is external ('xs', 'sm', 'md', 'lg', 'xl'). | 'md' |
|
|
80
|
+
| color | string | The color of the link text. | |
|
|
81
|
+
| textDecorationColor | string | The color of the text decoration (e.g., underline). | |
|
|
82
|
+
| styles | CSSProperties | Optional custom styles for the link (container, text, icon). | |
|
|
83
|
+
| children | React.ReactNode | The content of the link (typically text or an icon). | |
|