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
{{ message }}
This repository was archived by the owner on Jan 13, 2025. It is now read-only.
Copy file name to clipboardexpand all lines: packages/mdc-textfield/README.md
+10-7
Original file line number
Diff line number
Diff line change
@@ -129,7 +129,6 @@ See [here](helper-text/) for more information on using helper text.
129
129
Leading and trailing icons can be added within the default or outlined variant of MDC Text Field as visual indicators as
130
130
well as interaction targets. See [here](icon/) for more information on using icons.
131
131
132
-
133
132
### HTML5 Validation
134
133
135
134
`MDCTextFieldFoundation` provides validity styling by using the `:invalid` and `:required` attributes provided
@@ -237,10 +236,12 @@ Property | Value Type | Description
237
236
`disabled` | boolean | Proxies to the foundation's `isDisabled`/`setDisabled` methods.
238
237
`useNativeValidation` | boolean (write-only) | Proxies to the foundation's `setUseNativeValidation` method.
239
238
`valid` | boolean | Proxies to the foundation's `isValid`/`setValid` methods.
240
-
`helperTextContent` | string (write-only) | Proxies to the foundation's `setHelperTextContent` method when set.
241
-
`iconAriaLabel` | string (write-only) | Proxies to the foundation's `setIconAriaLabel` method when set.
242
-
`iconContent` | string (write-only) | Proxies to the foundation's `setIconContent` method when set.
243
-
`ripple` | `MDCRipple` (read-only) | The `MDCRipple` instance for the root element that `MDCTextField` initializes; this only applies to the default Text Field, and is `null` for other variants.
239
+
`helperTextContent` | string (write-only)| Proxies to the foundation's `setHelperTextContent` method when set.
240
+
`ripple` | `MDCRipple` (write-only) | The `MDCRipple` instance for the root element that `MDCTextField` initializes; this only applies to the default Text Field, and is `null` for other variants.
241
+
`leadingIconAriaLabel` | string (write-only) | Proxies to the foundation's `setLeadingIconAriaLabel` method.
242
+
`trailingIconAriaLabel` | string (write-only) | Proxies to the foundation's `setTrailingIconAriaLabel` method.
243
+
`leadingIconContent` | string (write-only) | Proxies to the foundation's `setLeadingIconContent` method.
244
+
`trailingIconContent` | string (write-only) | Proxies to the foundation's `setTrailingIconContent` method.
244
245
245
246
In addition to the above, the following properties proxy to the `input` element's properties of the same name:
`activateFocus() => void` | Activates the focus state of the Text Field. Normally called in response to the input focus event.
305
306
`deactivateFocus() => void` | Deactivates the focus state of the Text Field. Normally called in response to the input blur event.
306
307
`setHelperTextContent(content: string) => void` | Sets the content of the helper text.
307
-
`setIconAriaLabel(label: string) => void` | Sets the aria label of the icon.
308
-
`setIconContent(content: string) => void` | Sets the text content of the icon.
308
+
`setLeadingIconAriaLabel(label: string) => void` | Sets the aria label of the leading icon.
309
+
`setLeadingIconContent(content: string) => void` | Sets the text content of the leading icon.
310
+
`setTrailingIconAriaLabel(label: string) => void` | Sets the aria label of the trailing icon.
311
+
`setTrailingIconContent(content: string) => void` | Sets the text content of the trailing icon.
309
312
`notchOutline(openNotch: boolean) => void` | Opens/closes the notched outline.
310
313
311
314
`MDCTextFieldFoundation` supports multiple optional sub-elements: helper text and icon. The foundations of these sub-elements must be passed in as constructor arguments to `MDCTextFieldFoundation`.
Copy file name to clipboardexpand all lines: packages/mdc-textfield/icon/README.md
+40-7
Original file line number
Diff line number
Diff line change
@@ -42,11 +42,14 @@ const icon = new MDCTextFieldIcon(document.querySelector('.mdc-text-field-icon')
42
42
```
43
43
## Variants
44
44
45
-
Leading and trailing icons can be applied to text fields styled as `mdc-text-field--box` or `mdc-text-field--outlined`. To add an icon, add the relevant class (either `mdc-text-field--with-leading-icon` or `mdc-text-field--with-trailing-icon`) to the root element, add an `i` element with your preferred icon, and give it a class of `mdc-text-field__icon`.
45
+
Leading and trailing icons can be applied to default or `mdc-text-field--outlined` Text Fields. To add an icon, add the relevant class (`mdc-text-field--with-leading-icon` and/or `mdc-text-field--with-trailing-icon`) to the root element, add an `i` element with your preferred icon, and give it a class of `mdc-text-field__icon`. If using 2 icons at the same time, the first icon inside the `mdc-text-field` element will be interpreted as the leading icon and the second icon will be interpreted as the trailing icon.
46
+
47
+
> **NOTE:** if you would like to display un-clickable icons, simply omit `tabindex="0"` and `role="button"`, and the CSS will ensure the cursor is set to default, and that interacting with an icon doesn't do anything unexpected.
`mdc-text-field-icon-color($color)` | Customizes the color for the leading/trailing icons.
150
+
`mdc-text-field-icon-color($color, $styleSecondIcon: false)` | Customizes the color for the leading/trailing icons. If the `$styleSecondIcon` is `true` it will output the color to only apply to a trailing icon when used with a leading icon.
0 commit comments