rio
rio copied to clipboard
Display Required Fields, Supporting Text and Icons for `TextInputs`
Description
Currently, our TextInputs
component lacks the ability to indicate which fields are required, provide supporting text, and display leading and trailing icons. These features are crucial for enhancing user experience by guiding them through forms more effectively, ensuring they understand what information is needed, and improving the overall aesthetics and functionality of the input fields.
Design Guidline
https://m3.material.io/components/text-fields/guidelines
Proposed Solution
Required Fields Indicator:
- Add
is_required
attribute to theTextInput
component. - When
is_required
is set toTrue
, display an asterisk (*) next to the label. - Optionally, add a
is_required_indicator
attribute to allow customization of the indicator (e.g., text, color). needs discussion
Supporting Text:
- Add
supporting_text
attribute to theTextInput
component. - The supporting text should be displayed below the input field.
- Style the supporting text to be visually distinct but not distracting (see Design Guidline).
Leading Icon:
- Add a
leading_icon
attribute to theTextInput
component. naming needs discussion - The
leading_icon
should be displayed inside theTextInput
, aligned to the left. - Allow customization of the icon, which accepts an icon component or a string for the icon name.
Trailing Icon:
- Add a
trailing_icon
attribute to theTextInput
component. naming needs discussion - The
trailing_icon
should be displayed inside theTextInput
, aligned to the right. - Allow customization of the icon, which accepts an icon component or a string for the icon name.
Alternatives
No response
Additional Context
- Since
TextInput
andNumberInput
are very similar, we should not forget to update the python interface forNumberInput
. - Update documentation and examples for these new features.
Related Issues/Pull Requests
#105, #106