Validator rules #1145
-
DescriptionHow are "rules" meant to be used in for example NumberInput (React), they dont seem to do anything at the moment?
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I think they were meant to be used together with I'd avoid using the In the meantime, the validator object itself can be used on its own to control rendering of error/success messages for the fields, for example: <TextInput
label={'Label'}
info={
'Longer info text under the label'
}
expandableInfo="Text that can be viewed by clicking the info icon"
validator={{
message: 'Error message shown in red below the field',
indicator: 'error', // This can also be 'success', then the text will be green
}}
/> You can ignore the |
Beta Was this translation helpful? Give feedback.
I think they were meant to be used together with
<FormItems>
andFormContext
, but it is a bit unclear what the original idea was here. Most of that stuff was contributed to the library early on, and seem to be half-finished and is lacking any documentation.I'd avoid using the
FormContext
stuff, as it is likely that it will need substantial refactoring to be usable and maintainable. We'll probably need to rethink it anyway as we migrate the underlying implementation over to web components in Green Core.In the meantime, the validator object itself can be used on its own to control rendering of error/success messages for the fields, for example: