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(ui-buttons,ui-text-input): add condensed sizes to IconButton and simplify TextInput afterElement
Add condensedSmall and condensedMedium size options to IconButton,
matching Button's existing condensed size support. These are intended
for use inside compact layouts like TextInput.
Remove temporary workarounds from TextInput that were needed to make
the old IconButton work inside the afterElement slot:
- Remove adjustAfterElementHeight DOM hack
- Remove sizeVariants spread on afterElement container
- Remove afterElementHasWidth state machinery
- Simplify afterElement to a basic flex container with padding
Update documentation examples in both IconButton and TextInput READMEs
with a password visibility toggle use case and current icon names.
There are also two condensed size variants for compact layouts: `condensedSmall` and `condensedMedium`. These are designed to be used inside other components, such as a [TextInput](TextInput).
Because the IconButton visually only renders an icon, a description is necessary for assistive technologies. The `screenReaderLabel` prop is required for this purpose, and should consist of a complete description of the action.
Copy file name to clipboardExpand all lines: packages/ui-text-input/src/TextInput/v2/README.md
+21-14Lines changed: 21 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -164,7 +164,7 @@ type: example
164
164
render(<ExtraContentExample />)
165
165
```
166
166
167
-
Another common usecase is to add an `IconButton` at the end of a TextInput, e.g. for revealing the content of a password field. In these cases, please use the`withBorder={false}` and `withBackground={false}`props for the IconButton.
167
+
Another common usecase is to add an [IconButton](IconButton) at the end of a TextInput, e.g. for revealing the content of a password field. Use the `condensedMedium` size together with`withBorder={false}` and `withBackground={false}`on the IconButton.
// Set the height to 36px (the height of a medium TextInput) to avoid layout shift when the afterElement content changes
178
-
// this temporary workaround is necessary because otherwise the layout breaks, later on IconButton's default height will be adjusted to the TextInput size
179
-
// so this workaround will not be needed anymore
180
-
targetSpan.style.height='36px'
181
-
}
182
-
}
183
-
184
136
makeStyleProps=(): TextInputStyleProps=>{
185
-
const{ afterElementHasWidth }=this.state
186
137
constbeforeElement=this.props.renderBeforeInput
187
138
? callRenderProp(this.props.renderBeforeInput)
188
139
: null
@@ -193,7 +144,6 @@ class TextInput extends Component<TextInputProps, TextInputState> {
193
144
interaction: this.interaction,
194
145
invalid: this.invalid,
195
146
success: success,
196
-
afterElementHasWidth: afterElementHasWidth,
197
147
beforeElementExists: !!beforeElement
198
148
}
199
149
}
@@ -303,34 +253,6 @@ class TextInput extends Component<TextInputProps, TextInputState> {
0 commit comments