Skip to content

Commit

Permalink
[#415] Fix and update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
paulinea committed Jan 26, 2023
1 parent fbd20e9 commit f9adc10
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions docs/components/TextFields.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ OdsTextField(
leadingIcon = painterResource(id = R.drawable.ic_heart), // Optional
leadingIconContentDescription = "Like", // Optional
onLeadingIconClick = { doSomething() }, // Optional
trailing = OdsTextTrailing(text = "units"), // Optional, it can be one of the provided `OdsTextFieldTrailing`. See more information below.
enabled = true, // true if not set
readOnly = false, // false if not set
isError = false, // false if not set
Expand All @@ -89,10 +90,6 @@ OdsTextField(
onValueChange = { text = it },
label = "Label", // Optional
placeholder = "Placeholder", // Optional
trailingIcon = painterResource(id = R.drawable.ic_eye), // Optional
trailingIconContentDescription = "Show password", // Optional
onTrailingIconClick = { doSomething() }, // Optional
trailingText = "units", // Optional
visualTransformation = VisualTransformation.None, // `VisualTransformation.None` if not set
keyboardOptions = KeyboardOptions.Default, // `KeyboardOptions.Default` if not set
keyboardActions = KeyboardActions(), // `KeyboardActions()` if not set
Expand All @@ -108,6 +105,12 @@ OdsTextField(
)
```

The library provides several `OdsTextFieldTrailing` that you can use as a trailing element for text field:
- `OdsIconTrailing`: Displays an icon as trailing element
- `OdsTextTrailing`: Displays a text as trailing element

If you want a more complex trailing element, you can use the other `OdsTextField` API which allows you to pass directly a composable as trailing but you will have to maintain it and to manage the accessibility by yourself.

**Note:** You will find more information about the character counter in [Extras](#extras)

**Custom theme configuration:** You can override the default display of text fields in your custom theme by overriding the `textFieldStyle` attribute as below:
Expand Down

0 comments on commit f9adc10

Please sign in to comment.