1
- import React from "react" ;
1
+ import React , { useState } from "react" ;
2
2
import { navigate } from "gatsby" ;
3
3
import { useLocation } from "@reach/router" ;
4
4
5
5
import { SistentThemeProvider , Input } from "@sistent/sistent" ;
6
6
import { CodeBlock } from "../button/code-block" ;
7
- import { SistentLayout } from "../../sistent-layout" ;
8
- import { Row } from "../../../../../reusecore/Layout" ;
7
+
8
+
9
9
import TabButton from "../../../../../reusecore/Button" ;
10
+ import { SistentLayout } from "../../sistent-layout" ;
10
11
import { useStyledDarkMode } from "../../../../../theme/app/useStyledDarkMode" ;
11
12
12
13
const codes = [
13
14
"<Input placeholder=\"Enter your name\" />" ,
15
+ `<Input
16
+ label="Email Address"
17
+ type="email"
18
+
19
+ required
20
+ />` ,
14
21
`<Input
15
22
placeholder="Share your thoughts..."
16
23
multiline
24
+ rows={4}
25
+ />` ,
26
+ `<Input color="primary" placeholder="Primary" />
27
+ <Input color="secondary" placeholder="Secondary" />
28
+ <Input color="success" placeholder="Success" />` ,
29
+ `<Input
30
+ type="password"
31
+ label="Password"
32
+ placeholder="Enter password"
33
+ required
34
+ />
35
+ <Input
36
+ type="number"
37
+ label="Age"
38
+ placeholder="25"
39
+ />
40
+ <Input
41
+ type="tel"
42
+ label="Phone"
43
+ placeholder="+1 (555) 123-4567"
17
44
/>` ,
45
+ `<Input
46
+ label="Username"
47
+ placeholder="Enter username"
48
+ error
49
+ helperText="Username is already taken"
50
+ />` ,
51
+ `<Input
52
+ label="Read-only Field"
53
+ value="This field is disabled"
54
+ disabled
55
+ />`
18
56
] ;
19
57
20
58
const TextInputCode = ( ) => {
21
59
const location = useLocation ( ) ;
22
60
const { isDark } = useStyledDarkMode ( ) ;
61
+ const [ inputValue , setInputValue ] = useState ( "" ) ;
23
62
24
63
return (
25
64
< SistentLayout title = "Text Input" >
@@ -28,8 +67,9 @@ const TextInputCode = () => {
28
67
< h2 > Text Input</ h2 >
29
68
</ a >
30
69
< p >
31
- The < code > Input</ code > component enables users to enter text data in forms and interfaces.
32
- It provides a clean, accessible way to collect user information with support for different input types and multiline text.
70
+ Input components provide users with the ability to enter text data in forms and interfaces.
71
+ They support various input types, validation states, and customization options for creating
72
+ effective data collection experiences.
33
73
</ p >
34
74
< div className = "filterBtns" >
35
75
< TabButton
@@ -68,42 +108,160 @@ const TextInputCode = () => {
68
108
</ div >
69
109
< div className = "main-content" >
70
110
< p >
71
- The Input component provides flexible text input capabilities with minimal configuration .
72
- It integrates with Sistent's theming system while maintaining native HTML input behavior
73
- for optimal performance and accessibility .
111
+ The < code > Input</ code > component is essential for collecting user data in forms .
112
+ It provides immediate feedback during data entry, supports various input types,
113
+ and maintains consistency with your application's design system .
74
114
</ p >
75
115
76
116
< a id = "Basic Input" >
77
- < h2 > Basic Input</ h2 >
117
+ < h2 > Basic Text Input</ h2 >
78
118
</ a >
79
119
< p >
80
- A simple input field for collecting single-line text data. This is the most common form of text input.
120
+ A simple input field for collecting single-line text data. This is the most common
121
+ form of text input used across applications.
81
122
</ p >
82
123
< div className = "showcase" >
83
124
< div className = "items" >
84
125
< SistentThemeProvider initialMode = { isDark ? "dark" : "light" } >
85
126
< Input placeholder = "Enter your name" />
86
127
</ SistentThemeProvider >
87
128
</ div >
88
- < CodeBlock name = "basic-input" code = { codes [ 0 ] } />
129
+ < CodeBlock name = "input-basic" code = { codes [ 0 ] } />
130
+ </ div >
131
+
132
+ < a id = "Input with Label" >
133
+ < h2 > Labeled Input</ h2 >
134
+ </ a >
135
+ < p >
136
+ Inputs with labels provide better accessibility and user guidance. Labels clearly
137
+ identify the purpose of each input field and support screen readers.
138
+ </ p >
139
+ < div className = "showcase" >
140
+ < div className = "items" >
141
+ < SistentThemeProvider initialMode = { isDark ? "dark" : "light" } >
142
+ < Input
143
+ label = "Email Address"
144
+ type = "email"
145
+
146
+ required
147
+ />
148
+ </ SistentThemeProvider >
149
+ </ div >
150
+ < CodeBlock name = "input-labeled" code = { codes [ 1 ] } />
89
151
</ div >
90
152
91
153
< a id = "Multiline Input" >
92
- < h2 > Multiline Input</ h2 >
154
+ < h2 > Multiline Text Input</ h2 >
93
155
</ a >
94
156
< p >
95
- For longer text content that may span multiple lines. The input automatically expands vertically as users type.
157
+ For longer text content that may span multiple lines. The multiline input
158
+ automatically expands to accommodate content and provides users with adequate space.
96
159
</ p >
97
160
< div className = "showcase" >
98
161
< div className = "items" >
99
162
< SistentThemeProvider initialMode = { isDark ? "dark" : "light" } >
100
163
< Input
101
164
placeholder = "Share your thoughts..."
102
165
multiline
166
+ rows = { 4 }
167
+ />
168
+ </ SistentThemeProvider >
169
+ </ div >
170
+ < CodeBlock name = "input-multiline" code = { codes [ 2 ] } />
171
+ </ div >
172
+
173
+ < a id = "Color Options" >
174
+ < h2 > Color Options</ h2 >
175
+ </ a >
176
+ < p >
177
+ Input components support various color themes to match your application's
178
+ design system. Colors can convey different meanings or states within your interface.
179
+ </ p >
180
+ < div className = "showcase" >
181
+ < div className = "items" >
182
+ < SistentThemeProvider initialMode = { isDark ? "dark" : "light" } >
183
+ < div style = { { display : "flex" , flexDirection : "column" , gap : "16px" , alignItems : "flex-start" } } >
184
+ < Input color = "primary" placeholder = "Primary" />
185
+ < Input color = "secondary" placeholder = "Secondary" />
186
+ < Input color = "success" placeholder = "Success" />
187
+ </ div >
188
+ </ SistentThemeProvider >
189
+ </ div >
190
+ < CodeBlock name = "input-colors" code = { codes [ 3 ] } />
191
+ </ div >
192
+
193
+ < a id = "Input Types" >
194
+ < h2 > Different Input Types</ h2 >
195
+ </ a >
196
+ < p >
197
+ Various input types provide specialized behavior and validation for different
198
+ data formats. Choose the appropriate type to enhance user experience and data quality.
199
+ </ p >
200
+ < div className = "showcase" >
201
+ < div className = "items" >
202
+ < SistentThemeProvider initialMode = { isDark ? "dark" : "light" } >
203
+ < div style = { { display : "flex" , flexDirection : "column" , gap : "16px" , alignItems : "flex-start" } } >
204
+ < Input
205
+ type = "password"
206
+ label = "Password"
207
+ placeholder = "Enter password"
208
+ required
209
+ />
210
+ < Input
211
+ type = "number"
212
+ label = "Age"
213
+ placeholder = "25"
214
+ />
215
+ < Input
216
+ type = "tel"
217
+ label = "Phone"
218
+ placeholder = "+1 (555) 123-4567"
219
+ />
220
+ </ div >
221
+ </ SistentThemeProvider >
222
+ </ div >
223
+ < CodeBlock name = "input-types" code = { codes [ 4 ] } />
224
+ </ div >
225
+
226
+ < a id = "Error State" >
227
+ < h2 > Error State</ h2 >
228
+ </ a >
229
+ < p >
230
+ Error states provide visual feedback when validation fails. Combined with helper text,
231
+ they guide users toward resolving input issues effectively.
232
+ </ p >
233
+ < div className = "showcase" >
234
+ < div className = "items" >
235
+ < SistentThemeProvider initialMode = { isDark ? "dark" : "light" } >
236
+ < Input
237
+ label = "Username"
238
+ placeholder = "Enter username"
239
+ error
240
+ helperText = "Username is already taken"
241
+ />
242
+ </ SistentThemeProvider >
243
+ </ div >
244
+ < CodeBlock name = "input-error" code = { codes [ 5 ] } />
245
+ </ div >
246
+
247
+ < a id = "Disabled State" >
248
+ < h2 > Disabled State</ h2 >
249
+ </ a >
250
+ < p >
251
+ Disabled inputs are non-interactive and typically used for read-only data
252
+ or when certain conditions haven't been met to enable the input.
253
+ </ p >
254
+ < div className = "showcase" >
255
+ < div className = "items" >
256
+ < SistentThemeProvider initialMode = { isDark ? "dark" : "light" } >
257
+ < Input
258
+ label = "Read-only Field"
259
+ value = "This field is disabled"
260
+ disabled
103
261
/>
104
262
</ SistentThemeProvider >
105
263
</ div >
106
- < CodeBlock name = "multiline- input" code = { codes [ 1 ] } />
264
+ < CodeBlock name = "input-disabled " code = { codes [ 6 ] } />
107
265
</ div >
108
266
</ div >
109
267
</ div >
0 commit comments