@app-studio/web 0.9.17 → 0.9.19
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/dist/components/AuthGuard/index.d.ts +1 -1
- package/dist/utils/request.d.ts +2 -2
- package/dist/web.cjs.development.js +41 -46
- package/dist/web.cjs.development.js.map +1 -1
- package/dist/web.cjs.production.min.js +1 -1
- package/dist/web.cjs.production.min.js.map +1 -1
- package/dist/web.esm.js +43 -48
- package/dist/web.esm.js.map +1 -1
- package/dist/web.umd.development.js +45 -45
- package/dist/web.umd.development.js.map +1 -1
- package/dist/web.umd.production.min.js +1 -1
- package/dist/web.umd.production.min.js.map +1 -1
- package/docs/README.md +52 -0
- package/docs/adk-components.md +316 -0
- package/docs/adk-quick-start.md +294 -0
- package/docs/api-integration.md +801 -0
- package/docs/api-reference/README.md +103 -0
- package/docs/api-reference/data-display/flow.md +220 -0
- package/docs/api-reference/data-display/tree.md +210 -0
- package/docs/api-reference/form/chat-input.md +210 -0
- package/docs/api-reference/utility/button.md +145 -0
- package/docs/api-reference/utility/title.md +301 -0
- package/docs/app-studio.md +302 -0
- package/docs/component-development/guide.md +546 -0
- package/docs/contributing/documentation.md +153 -0
- package/docs/conventions.md +536 -0
- package/docs/design-system/theming.md +299 -0
- package/docs/documentation-system.md +143 -0
- package/docs/getting-started/component-usage.md +211 -0
- package/docs/getting-started/introduction.md +114 -0
- package/docs/guide.md +550 -0
- package/docs/integration-guide.md +449 -0
- package/docs/tutorials/README.md +51 -0
- package/docs/tutorials/basic/creating-a-simple-form.md +566 -0
- package/package.json +3 -2
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
# ChatInput
|
|
2
|
+
|
|
3
|
+
The ChatInput component is a customizable chat input field with support for file uploads, prompt examples, and reference images.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```jsx
|
|
8
|
+
import { ChatInput } from '@app-studio/web';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Props
|
|
12
|
+
|
|
13
|
+
| Prop | Type | Default | Description |
|
|
14
|
+
| ---- | ---- | ------- | ----------- |
|
|
15
|
+
| onSubmit | (message: string, options?: { model_name?: string; enable_thinking?: boolean }) => void | required | Callback function when the form is submitted |
|
|
16
|
+
| placeholder | string | 'Say what you want and Kimmy will surprise you' | Placeholder text for the input |
|
|
17
|
+
| loading | boolean | false | Whether the input is in a loading state |
|
|
18
|
+
| disabled | boolean | false | Whether the input is disabled |
|
|
19
|
+
| isAgentRunning | boolean | false | Whether an agent is currently running |
|
|
20
|
+
| onStopAgent | () => void | undefined | Callback function to stop the agent |
|
|
21
|
+
| autoFocus | boolean | true | Whether to auto focus the input |
|
|
22
|
+
| value | string | undefined | Controlled value for the input |
|
|
23
|
+
| onChange | (value: string) => void | undefined | Callback function when the input value changes |
|
|
24
|
+
| onFileBrowse | () => void | undefined | Callback function when the file browser is opened |
|
|
25
|
+
| sandboxId | string | undefined | ID of the sandbox |
|
|
26
|
+
| hideAttachments | boolean | false | Whether to hide the attachment button |
|
|
27
|
+
| title | string | undefined | Title for the chat input |
|
|
28
|
+
| showGuideTip | boolean | false | Whether to show the guide tip |
|
|
29
|
+
| guideVideoUrl | string | undefined | URL for the guide video |
|
|
30
|
+
| onGuideClose | () => void | undefined | Callback function when the guide tip is closed |
|
|
31
|
+
| promptExamples | PromptExample[] | [] | List of prompt examples |
|
|
32
|
+
| onPromptExampleSelect | (example: PromptExample) => void | undefined | Callback function when a prompt example is selected |
|
|
33
|
+
| showReferenceImageButton | boolean | false | Whether to show the reference image button |
|
|
34
|
+
| onReferenceImageClick | () => void | undefined | Callback function when the reference image button is clicked |
|
|
35
|
+
| size | 'xs' \| 'sm' \| 'md' \| 'lg' \| 'xl' | 'md' | Size of the chat input |
|
|
36
|
+
| shape | 'default' \| 'sharp' \| 'rounded' \| 'pillShaped' | 'rounded' | Shape of the chat input |
|
|
37
|
+
| variant | 'default' \| 'outline' \| 'none' | 'default' | Visual variant of the chat input |
|
|
38
|
+
| views | object | {} | Custom styling for different parts of the component |
|
|
39
|
+
|
|
40
|
+
## Interfaces
|
|
41
|
+
|
|
42
|
+
### PromptExample
|
|
43
|
+
|
|
44
|
+
```tsx
|
|
45
|
+
interface PromptExample {
|
|
46
|
+
id: string;
|
|
47
|
+
text: string;
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### UploadedFile
|
|
52
|
+
|
|
53
|
+
```tsx
|
|
54
|
+
interface UploadedFile {
|
|
55
|
+
name: string;
|
|
56
|
+
path: string;
|
|
57
|
+
size: number;
|
|
58
|
+
type: string;
|
|
59
|
+
localUrl?: string;
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### ChatInputHandles
|
|
64
|
+
|
|
65
|
+
```tsx
|
|
66
|
+
interface ChatInputHandles {
|
|
67
|
+
getPendingFiles: () => File[];
|
|
68
|
+
clearPendingFiles: () => void;
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Examples
|
|
73
|
+
|
|
74
|
+
### Basic Usage
|
|
75
|
+
|
|
76
|
+
```jsx
|
|
77
|
+
import React, { useState } from 'react';
|
|
78
|
+
import { ChatInput } from '@app-studio/web';
|
|
79
|
+
import { View } from 'app-studio';
|
|
80
|
+
|
|
81
|
+
export const BasicChatInput = () => {
|
|
82
|
+
const [inputValue, setInputValue] = useState('');
|
|
83
|
+
|
|
84
|
+
const handleSubmit = (message) => {
|
|
85
|
+
console.log('Message submitted:', message);
|
|
86
|
+
setInputValue('');
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
return (
|
|
90
|
+
<View width="100%">
|
|
91
|
+
<ChatInput
|
|
92
|
+
onSubmit={handleSubmit}
|
|
93
|
+
value={inputValue}
|
|
94
|
+
onChange={setInputValue}
|
|
95
|
+
placeholder="Type your message here..."
|
|
96
|
+
/>
|
|
97
|
+
</View>
|
|
98
|
+
);
|
|
99
|
+
};
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### With Prompt Examples
|
|
103
|
+
|
|
104
|
+
```jsx
|
|
105
|
+
import React, { useState } from 'react';
|
|
106
|
+
import { ChatInput } from '@app-studio/web';
|
|
107
|
+
import { View } from 'app-studio';
|
|
108
|
+
|
|
109
|
+
export const ChatInputWithPromptExamples = () => {
|
|
110
|
+
const [inputValue, setInputValue] = useState('');
|
|
111
|
+
|
|
112
|
+
// Example prompt suggestions
|
|
113
|
+
const promptExamples = [
|
|
114
|
+
{ id: '1', text: 'Tell me a joke' },
|
|
115
|
+
{ id: '2', text: 'What is the weather today?' },
|
|
116
|
+
{ id: '3', text: 'How do I create a React component?' },
|
|
117
|
+
];
|
|
118
|
+
|
|
119
|
+
const handleSubmit = (message) => {
|
|
120
|
+
console.log('Message submitted:', message);
|
|
121
|
+
setInputValue('');
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
return (
|
|
125
|
+
<View width="100%">
|
|
126
|
+
<ChatInput
|
|
127
|
+
onSubmit={handleSubmit}
|
|
128
|
+
value={inputValue}
|
|
129
|
+
onChange={setInputValue}
|
|
130
|
+
promptExamples={promptExamples}
|
|
131
|
+
/>
|
|
132
|
+
</View>
|
|
133
|
+
);
|
|
134
|
+
};
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### With File Uploads
|
|
138
|
+
|
|
139
|
+
```jsx
|
|
140
|
+
import React, { useRef } from 'react';
|
|
141
|
+
import { ChatInput, ChatInputHandles } from '@app-studio/web';
|
|
142
|
+
import { View } from 'app-studio';
|
|
143
|
+
|
|
144
|
+
export const ChatInputWithFileUploads = () => {
|
|
145
|
+
const chatInputRef = useRef<ChatInputHandles>(null);
|
|
146
|
+
|
|
147
|
+
const handleSubmit = (message) => {
|
|
148
|
+
// Get any pending files
|
|
149
|
+
const pendingFiles = chatInputRef.current?.getPendingFiles() || [];
|
|
150
|
+
console.log('Message submitted:', message);
|
|
151
|
+
console.log('Pending files:', pendingFiles);
|
|
152
|
+
|
|
153
|
+
// Clear pending files after submission
|
|
154
|
+
chatInputRef.current?.clearPendingFiles();
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
return (
|
|
158
|
+
<View width="100%">
|
|
159
|
+
<ChatInput
|
|
160
|
+
ref={chatInputRef}
|
|
161
|
+
onSubmit={handleSubmit}
|
|
162
|
+
hideAttachments={false}
|
|
163
|
+
/>
|
|
164
|
+
</View>
|
|
165
|
+
);
|
|
166
|
+
};
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Customization
|
|
170
|
+
|
|
171
|
+
The ChatInput component can be customized using the `views` prop:
|
|
172
|
+
|
|
173
|
+
```jsx
|
|
174
|
+
<ChatInput
|
|
175
|
+
// ...other props
|
|
176
|
+
views={{
|
|
177
|
+
container: { /* styles for the main container */ },
|
|
178
|
+
content: { /* styles for the content wrapper */ },
|
|
179
|
+
editableInput: { /* styles for the editable input */ },
|
|
180
|
+
header: { /* styles for the header */ },
|
|
181
|
+
title: { /* styles for the title */ },
|
|
182
|
+
guideTip: { /* styles for the guide tip */ },
|
|
183
|
+
promptExamples: { /* styles for the prompt examples container */ },
|
|
184
|
+
promptExampleItem: { /* styles for each prompt example item */ },
|
|
185
|
+
referenceImageButton: { /* styles for the reference image button */ },
|
|
186
|
+
referenceImageModal: { /* styles for the reference image modal */ },
|
|
187
|
+
attachments: { /* styles for the attachments container */ },
|
|
188
|
+
attachmentItem: { /* styles for each attachment item */ },
|
|
189
|
+
submitButton: { /* styles for the submit button */ },
|
|
190
|
+
fileButton: { /* styles for the file button */ },
|
|
191
|
+
}}
|
|
192
|
+
/>
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## Accessibility
|
|
196
|
+
|
|
197
|
+
The ChatInput component implements the following accessibility features:
|
|
198
|
+
|
|
199
|
+
- Keyboard navigation for submitting messages (Enter key)
|
|
200
|
+
- ARIA attributes for interactive elements
|
|
201
|
+
- Focus management for the input field
|
|
202
|
+
- Proper contrast for text and buttons
|
|
203
|
+
|
|
204
|
+
## Best Practices
|
|
205
|
+
|
|
206
|
+
- Provide clear placeholder text to guide users
|
|
207
|
+
- Handle file uploads appropriately on the server side
|
|
208
|
+
- Implement proper error handling for message submission
|
|
209
|
+
- Use the `loading` state to indicate when a message is being processed
|
|
210
|
+
- Provide feedback to users when messages are sent successfully
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
# Button
|
|
2
|
+
|
|
3
|
+
The Button component is used to trigger an action or event.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```jsx
|
|
8
|
+
import { Button } from '@app-studio/web';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Props
|
|
12
|
+
|
|
13
|
+
| Prop | Type | Default | Description |
|
|
14
|
+
| ---- | ---- | ------- | ----------- |
|
|
15
|
+
| variant | 'filled' \| 'outline' \| 'ghost' \| 'link' | 'filled' | The visual style of the button |
|
|
16
|
+
| size | 'xs' \| 'sm' \| 'md' \| 'lg' \| 'xl' | 'md' | The size of the button |
|
|
17
|
+
| shape | 'sharp' \| 'rounded' \| 'pillShaped' | 'rounded' | The shape of the button |
|
|
18
|
+
| iconPosition | 'left' \| 'right' \| 'top' \| 'bottom' | 'left' | The position of the icon relative to the button text |
|
|
19
|
+
| loaderPosition | 'left' \| 'right' | 'left' | The position of the loader relative to the button text |
|
|
20
|
+
| backgroundColor | string | - | The background color of the button |
|
|
21
|
+
| color | string | - | The color of the button text |
|
|
22
|
+
| isAuto | boolean | false | Whether the button should automatically adjust its width |
|
|
23
|
+
| isFilled | boolean | false | Whether the button should fill its container width |
|
|
24
|
+
| isDisabled | boolean | false | Whether the button is disabled |
|
|
25
|
+
| isLoading | boolean | false | Whether the button is in a loading state |
|
|
26
|
+
| isIconRounded | boolean | false | Whether the icon should have rounded corners |
|
|
27
|
+
| icon | React.ReactNode | - | The icon to display in the button |
|
|
28
|
+
| children | React.ReactNode | - | The content of the button |
|
|
29
|
+
| to | string | - | The URL to navigate to when the button is clicked (turns the button into a link) |
|
|
30
|
+
| isExternal | boolean | false | Whether the link should open in a new tab |
|
|
31
|
+
| shadow | Shadow | - | The shadow style of the button |
|
|
32
|
+
| onClick | () => void | - | The function to call when the button is clicked |
|
|
33
|
+
| views | ButtonStyles | {} | Custom styles for different parts of the button |
|
|
34
|
+
| themeMode | 'light' \| 'dark' | - | Optional theme mode override |
|
|
35
|
+
|
|
36
|
+
## Examples
|
|
37
|
+
|
|
38
|
+
### Basic Button
|
|
39
|
+
|
|
40
|
+
```jsx
|
|
41
|
+
<Button onClick={() => alert('Button clicked!')}>Click Me</Button>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Button Variants
|
|
45
|
+
|
|
46
|
+
```jsx
|
|
47
|
+
<>
|
|
48
|
+
<Button variant="filled">Filled</Button>
|
|
49
|
+
<Button variant="outline">Outline</Button>
|
|
50
|
+
<Button variant="ghost">Ghost</Button>
|
|
51
|
+
<Button variant="link">Link</Button>
|
|
52
|
+
</>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Button Sizes
|
|
56
|
+
|
|
57
|
+
```jsx
|
|
58
|
+
<>
|
|
59
|
+
<Button size="xs">Extra Small</Button>
|
|
60
|
+
<Button size="sm">Small</Button>
|
|
61
|
+
<Button size="md">Medium</Button>
|
|
62
|
+
<Button size="lg">Large</Button>
|
|
63
|
+
<Button size="xl">Extra Large</Button>
|
|
64
|
+
</>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Button with Icon
|
|
68
|
+
|
|
69
|
+
```jsx
|
|
70
|
+
import { DustBinIcon } from '@app-studio/web';
|
|
71
|
+
|
|
72
|
+
<Button icon={<DustBinIcon widthHeight={16} />}>Delete</Button>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Button with Icon Position
|
|
76
|
+
|
|
77
|
+
```jsx
|
|
78
|
+
import { DustBinIcon } from '@app-studio/web';
|
|
79
|
+
|
|
80
|
+
<>
|
|
81
|
+
<Button icon={<DustBinIcon widthHeight={16} />} iconPosition="left">Left Icon</Button>
|
|
82
|
+
<Button icon={<DustBinIcon widthHeight={16} />} iconPosition="right">Right Icon</Button>
|
|
83
|
+
<Button icon={<DustBinIcon widthHeight={16} />} iconPosition="top">Top Icon</Button>
|
|
84
|
+
<Button icon={<DustBinIcon widthHeight={16} />} iconPosition="bottom">Bottom Icon</Button>
|
|
85
|
+
</>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Loading Button
|
|
89
|
+
|
|
90
|
+
```jsx
|
|
91
|
+
<Button isLoading>Loading</Button>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Disabled Button
|
|
95
|
+
|
|
96
|
+
```jsx
|
|
97
|
+
<Button isDisabled>Disabled</Button>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Link Button
|
|
101
|
+
|
|
102
|
+
```jsx
|
|
103
|
+
<Button to="/dashboard" variant="link">Go to Dashboard</Button>
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### External Link Button
|
|
107
|
+
|
|
108
|
+
```jsx
|
|
109
|
+
<Button to="https://example.com" isExternal variant="link">External Link</Button>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Custom Styled Button
|
|
113
|
+
|
|
114
|
+
```jsx
|
|
115
|
+
<Button
|
|
116
|
+
views={{
|
|
117
|
+
container: {
|
|
118
|
+
backgroundColor: '#6200ee',
|
|
119
|
+
borderRadius: 8,
|
|
120
|
+
boxShadow: '0 4px 6px rgba(0, 0, 0, 0.1)',
|
|
121
|
+
},
|
|
122
|
+
}}
|
|
123
|
+
>
|
|
124
|
+
Custom Styled Button
|
|
125
|
+
</Button>
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Accessibility
|
|
129
|
+
|
|
130
|
+
The Button component:
|
|
131
|
+
|
|
132
|
+
- Uses the native `<button>` element for proper keyboard navigation and screen reader support
|
|
133
|
+
- Supports the `aria-disabled` attribute when disabled
|
|
134
|
+
- Maintains proper focus states for keyboard users
|
|
135
|
+
- Uses appropriate color contrast for text and background
|
|
136
|
+
|
|
137
|
+
## Best Practices
|
|
138
|
+
|
|
139
|
+
- Use clear, concise text that describes the action
|
|
140
|
+
- Use the appropriate variant for the context (primary actions should use 'filled')
|
|
141
|
+
- Include an icon only when it adds meaning or clarity
|
|
142
|
+
- Avoid using too many buttons in close proximity
|
|
143
|
+
- Use consistent button styles throughout your application
|
|
144
|
+
- Consider the visual hierarchy of multiple buttons (primary, secondary actions)
|
|
145
|
+
- Use the `isLoading` state for actions that take time to complete
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
# Title
|
|
2
|
+
|
|
3
|
+
The Title component is used for rendering animated and highlighted titles in hero sections and other prominent areas of the UI.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```jsx
|
|
8
|
+
import { Title } from '@app-studio/web';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Props
|
|
12
|
+
|
|
13
|
+
| Prop | Type | Default | Description |
|
|
14
|
+
| ---- | ---- | ------- | ----------- |
|
|
15
|
+
| children | React.ReactNode | - | The main text content of the title |
|
|
16
|
+
| highlightText | string \| string[] | - | Text to be highlighted within the title. If not provided, no highlighting will be applied |
|
|
17
|
+
| highlightStyle | 'background' \| 'underline' \| 'gradient' \| 'outline' \| 'glow' | 'background' | The visual style of the highlighted text |
|
|
18
|
+
| highlightColor | string | 'theme.primary' | The color of the highlighted text or background |
|
|
19
|
+
| highlightSecondaryColor | string | - | The secondary color for gradient highlights |
|
|
20
|
+
| size | 'xs' \| 'sm' \| 'md' \| 'lg' \| 'xl' \| 'xl' \| 'xl' \| 'xl' \| 'xl' \| '6xl' | 'xl' | The size of the title |
|
|
21
|
+
| centered | boolean | false | Whether to center the title |
|
|
22
|
+
| animate | AnimationProps \| AnimationProps[] | - | Animation for the title. This should be an animation object with properties like from, to, duration, etc. |
|
|
23
|
+
| highlightAnimate | AnimationProps \| AnimationProps[] | - | Animation specifically for the highlighted text |
|
|
24
|
+
| alternateHighlightText | string[] | [] | Array of strings to cycle through, replacing the text specified in highlightText |
|
|
25
|
+
| alternateAnimation | boolean | false | Whether to animate the alternating highlight text |
|
|
26
|
+
| alternateDuration | number | 3000 | Duration in milliseconds for each alternating highlight text |
|
|
27
|
+
| highlightTypewriter | boolean | false | Whether to apply a typewriter effect to the highlighted text |
|
|
28
|
+
| highlightTypewriterDuration | number | 3000 | Duration in milliseconds for the typewriter effect |
|
|
29
|
+
| views | TitleStyles | {} | Custom styles for different parts of the title |
|
|
30
|
+
| themeMode | 'light' \| 'dark' | - | Optional theme mode override |
|
|
31
|
+
|
|
32
|
+
## Examples
|
|
33
|
+
|
|
34
|
+
### Basic Title
|
|
35
|
+
|
|
36
|
+
```jsx
|
|
37
|
+
<Title>Simple Hero Title</Title>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Title Sizes
|
|
41
|
+
|
|
42
|
+
```jsx
|
|
43
|
+
<>
|
|
44
|
+
<Title size="xs">Extra Small Title (xs)</Title>
|
|
45
|
+
<Title size="sm">Small Title (sm)</Title>
|
|
46
|
+
<Title size="md">Medium Title (md)</Title>
|
|
47
|
+
<Title size="lg">Large Title (lg)</Title>
|
|
48
|
+
<Title size="xl">Extra Large Title (xl - default)</Title>
|
|
49
|
+
<Title size="xl">2XL Title</Title>
|
|
50
|
+
<Title size="xl">3XL Title</Title>
|
|
51
|
+
<Title size="xl">4XL Title</Title>
|
|
52
|
+
<Title size="xl">5XL Title</Title>
|
|
53
|
+
<Title size="6xl">6XL Title</Title>
|
|
54
|
+
</>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Highlighted Title
|
|
58
|
+
|
|
59
|
+
```jsx
|
|
60
|
+
<Title
|
|
61
|
+
highlightText="highlighted"
|
|
62
|
+
highlightStyle="background"
|
|
63
|
+
highlightColor="theme.primary"
|
|
64
|
+
>
|
|
65
|
+
Text with highlighted words
|
|
66
|
+
</Title>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Highlight Styles
|
|
70
|
+
|
|
71
|
+
```jsx
|
|
72
|
+
<>
|
|
73
|
+
<Title
|
|
74
|
+
highlightText="background"
|
|
75
|
+
highlightStyle="background"
|
|
76
|
+
highlightColor="theme.primary"
|
|
77
|
+
>
|
|
78
|
+
Text with background highlight
|
|
79
|
+
</Title>
|
|
80
|
+
|
|
81
|
+
<Title
|
|
82
|
+
highlightText="underlined"
|
|
83
|
+
highlightStyle="underline"
|
|
84
|
+
highlightColor="theme.secondary"
|
|
85
|
+
>
|
|
86
|
+
Text with underlined highlight
|
|
87
|
+
</Title>
|
|
88
|
+
|
|
89
|
+
<Title
|
|
90
|
+
highlightText="gradient"
|
|
91
|
+
highlightStyle="gradient"
|
|
92
|
+
highlightColor="theme.primary"
|
|
93
|
+
highlightSecondaryColor="theme.secondary"
|
|
94
|
+
>
|
|
95
|
+
Text with gradient highlight
|
|
96
|
+
</Title>
|
|
97
|
+
|
|
98
|
+
<Title
|
|
99
|
+
highlightText="outline"
|
|
100
|
+
highlightStyle="outline"
|
|
101
|
+
highlightColor="theme.primary"
|
|
102
|
+
>
|
|
103
|
+
Text with outline highlight
|
|
104
|
+
</Title>
|
|
105
|
+
|
|
106
|
+
<Title
|
|
107
|
+
highlightText="glow"
|
|
108
|
+
highlightStyle="glow"
|
|
109
|
+
highlightColor="theme.primary"
|
|
110
|
+
>
|
|
111
|
+
Text with glow highlight
|
|
112
|
+
</Title>
|
|
113
|
+
</>
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Multiple Highlights
|
|
117
|
+
|
|
118
|
+
```jsx
|
|
119
|
+
<Title
|
|
120
|
+
highlightText={['multiple', 'highlights']}
|
|
121
|
+
highlightStyle="background"
|
|
122
|
+
highlightColor="theme.primary"
|
|
123
|
+
>
|
|
124
|
+
Text with multiple highlights in the same sentence
|
|
125
|
+
</Title>
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Animated Title
|
|
129
|
+
|
|
130
|
+
```jsx
|
|
131
|
+
<Title
|
|
132
|
+
animate={{
|
|
133
|
+
from: { opacity: 0 },
|
|
134
|
+
to: { opacity: 1 },
|
|
135
|
+
duration: '1.5s',
|
|
136
|
+
iterationCount: '1',
|
|
137
|
+
}}
|
|
138
|
+
>
|
|
139
|
+
Fade In Animation
|
|
140
|
+
</Title>
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Animated Highlight
|
|
144
|
+
|
|
145
|
+
```jsx
|
|
146
|
+
<Title
|
|
147
|
+
highlightText="animated highlight"
|
|
148
|
+
highlightStyle="background"
|
|
149
|
+
highlightColor="theme.primary"
|
|
150
|
+
highlightAnimate={{
|
|
151
|
+
from: { opacity: 0, transform: 'scale(0.9)' },
|
|
152
|
+
to: { opacity: 1, transform: 'scale(1)' },
|
|
153
|
+
duration: '0.5s',
|
|
154
|
+
delay: '0.2s',
|
|
155
|
+
}}
|
|
156
|
+
>
|
|
157
|
+
Text with animated highlight
|
|
158
|
+
</Title>
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Alternating Highlight Text
|
|
162
|
+
|
|
163
|
+
```jsx
|
|
164
|
+
<Title
|
|
165
|
+
highlightText="changing"
|
|
166
|
+
alternateHighlightText={[
|
|
167
|
+
'innovative',
|
|
168
|
+
'powerful',
|
|
169
|
+
'flexible',
|
|
170
|
+
'intuitive',
|
|
171
|
+
]}
|
|
172
|
+
alternateAnimation={true}
|
|
173
|
+
alternateDuration={2000}
|
|
174
|
+
highlightStyle="background"
|
|
175
|
+
highlightColor="theme.primary"
|
|
176
|
+
>
|
|
177
|
+
Our changing solution for your business
|
|
178
|
+
</Title>
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Typewriter Effect
|
|
182
|
+
|
|
183
|
+
```jsx
|
|
184
|
+
<Title
|
|
185
|
+
highlightText="typewriter"
|
|
186
|
+
highlightStyle="background"
|
|
187
|
+
highlightColor="theme.primary"
|
|
188
|
+
highlightTypewriter={true}
|
|
189
|
+
highlightTypewriterDuration={1500}
|
|
190
|
+
>
|
|
191
|
+
This text has a typewriter effect on the highlighted word
|
|
192
|
+
</Title>
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### Responsive Title
|
|
196
|
+
|
|
197
|
+
```jsx
|
|
198
|
+
<Title
|
|
199
|
+
media={{
|
|
200
|
+
mobile: {
|
|
201
|
+
fontSize: 32,
|
|
202
|
+
lineHeight: '40px',
|
|
203
|
+
},
|
|
204
|
+
tablet: {
|
|
205
|
+
fontSize: 48,
|
|
206
|
+
lineHeight: '56px',
|
|
207
|
+
},
|
|
208
|
+
desktop: {
|
|
209
|
+
fontSize: 64,
|
|
210
|
+
lineHeight: '72px',
|
|
211
|
+
},
|
|
212
|
+
}}
|
|
213
|
+
highlightText="Responsive"
|
|
214
|
+
highlightStyle="background"
|
|
215
|
+
highlightColor="theme.primary"
|
|
216
|
+
>
|
|
217
|
+
Responsive Title Example
|
|
218
|
+
</Title>
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### Custom Styling
|
|
222
|
+
|
|
223
|
+
```jsx
|
|
224
|
+
<Title
|
|
225
|
+
views={{
|
|
226
|
+
container: {
|
|
227
|
+
fontFamily: 'Georgia, serif',
|
|
228
|
+
letterSpacing: '0.05em',
|
|
229
|
+
textTransform: 'uppercase',
|
|
230
|
+
},
|
|
231
|
+
highlight: {
|
|
232
|
+
borderRadius: '8px',
|
|
233
|
+
padding: '0 12px',
|
|
234
|
+
},
|
|
235
|
+
}}
|
|
236
|
+
highlightText="Custom"
|
|
237
|
+
highlightStyle="background"
|
|
238
|
+
highlightColor="color.purple.500"
|
|
239
|
+
>
|
|
240
|
+
Title with Custom Styling
|
|
241
|
+
</Title>
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### Hero Section Example
|
|
245
|
+
|
|
246
|
+
```jsx
|
|
247
|
+
<View
|
|
248
|
+
backgroundColor="color.gray.50"
|
|
249
|
+
padding={48}
|
|
250
|
+
borderRadius={8}
|
|
251
|
+
width="100%"
|
|
252
|
+
>
|
|
253
|
+
<Vertical gap={24} maxWidth={800} marginX="auto">
|
|
254
|
+
<Title
|
|
255
|
+
size="xl"
|
|
256
|
+
animate={{
|
|
257
|
+
from: { opacity: 0 },
|
|
258
|
+
to: { opacity: 1 },
|
|
259
|
+
duration: '1s',
|
|
260
|
+
iterationCount: '1',
|
|
261
|
+
}}
|
|
262
|
+
highlightText="Platform"
|
|
263
|
+
highlightStyle="gradient"
|
|
264
|
+
highlightColor="theme.primary"
|
|
265
|
+
highlightSecondaryColor="theme.secondary"
|
|
266
|
+
centered
|
|
267
|
+
>
|
|
268
|
+
Welcome to Our Platform
|
|
269
|
+
</Title>
|
|
270
|
+
|
|
271
|
+
<Text
|
|
272
|
+
textAlign="center"
|
|
273
|
+
color="color.gray.600"
|
|
274
|
+
fontSize={20}
|
|
275
|
+
lineHeight={28}
|
|
276
|
+
>
|
|
277
|
+
Build beautiful, responsive, and interactive user interfaces with our
|
|
278
|
+
powerful component library.
|
|
279
|
+
</Text>
|
|
280
|
+
</Vertical>
|
|
281
|
+
</View>
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
## Accessibility
|
|
285
|
+
|
|
286
|
+
The Title component:
|
|
287
|
+
|
|
288
|
+
- Uses semantic heading elements (`<h1>`) for proper document structure
|
|
289
|
+
- Maintains proper color contrast for highlighted text
|
|
290
|
+
- Supports keyboard navigation and focus management
|
|
291
|
+
- Works with screen readers by using appropriate ARIA attributes
|
|
292
|
+
|
|
293
|
+
## Best Practices
|
|
294
|
+
|
|
295
|
+
- Use the Title component for main headings and important text that needs emphasis
|
|
296
|
+
- Choose highlight styles that maintain good contrast with the background
|
|
297
|
+
- Use animations sparingly to avoid distracting users
|
|
298
|
+
- Consider using responsive sizing for different screen sizes
|
|
299
|
+
- Limit the use of alternating text to avoid confusion
|
|
300
|
+
- Ensure that any animations respect user preferences for reduced motion
|
|
301
|
+
- Use semantic colors from the theme system rather than hardcoded values
|