You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: refine IconInput component in text field stories for improved accessibility and structure
- Simplified IconInput implementation by directly integrating the icon within the component.
- Enhanced CustomTextFieldExample to utilize the updated IconInput for better clarity and maintainability.
- Streamlined Storybook tests by removing unnecessary waitFor calls, ensuring efficient input handling.
- Updated documentation to reflect changes in IconInput structure and usage.
@@ -167,11 +157,24 @@ export const CustomComponents: Story = {
167
157
story: `
168
158
### TextField Component Customization
169
159
170
-
This example demonstrates three different approaches to customizing the TextField component:
160
+
This example demonstrates three different approaches to customizing the TextField component with complete control over styling and behavior.
161
+
162
+
#### 1. Default Styling
171
163
172
-
1. **Default Styling**: The first text field uses the default styling with no customization needed.
164
+
The first text field uses the default styling with no customization needed:
165
+
166
+
\`\`\`tsx
167
+
<TextField
168
+
name="username"
169
+
label="Username"
170
+
placeholder="Enter your username"
171
+
/>
172
+
\`\`\`
173
+
174
+
#### 2. Custom Styling with Purple Theme
175
+
176
+
The second text field customizes the Input, FormLabel, and FormMessage components with purple styling:
173
177
174
-
2. **Custom Styling**: The second text field customizes the Input, FormLabel, and FormMessage components with purple styling.
175
178
\`\`\`tsx
176
179
<TextField
177
180
name="email"
@@ -185,26 +188,80 @@ This example demonstrates three different approaches to customizing the TextFiel
185
188
/>
186
189
\`\`\`
187
190
188
-
3. **Icon Input**: The third text field demonstrates how to create a custom input with an icon. When using inline components, you must use React.forwardRef.
The third text field demonstrates how to create a custom input with an icon:
219
+
189
220
\`\`\`tsx
190
221
<TextField
191
222
name="password"
192
223
label="Password"
193
224
type="password"
194
225
placeholder="Enter your password"
195
226
components={{
196
-
Input: React.forwardRef((props, ref) => (
197
-
<IconInput
198
-
{...props}
199
-
ref={ref}
200
-
icon={<LockIcon />}
201
-
/>
202
-
)),
227
+
Input: IconInput,
203
228
}}
204
229
/>
205
230
\`\`\`
206
231
207
-
The \`components\` prop allows you to override any of the internal components used by the TextField component, giving you complete control over the styling and behavior.
0 commit comments