'How to shrink the ValidationMessage string in Blazor
I am new to blazor and currently working on a small project where I have a lot of text input fields on a page, which would be validated on submit. The page is responsive and would shrink into a column format when reducing device screen size. The message for a couple of validations is too long, and the string overflows out of its parent div element. What is a good way to fix that, and make the string break into multi-line? Code Code
Solution 1:[1]
The default ValidationMessage component generates a div and assigns the css class 'validation-message' at rendering time. If you want to change the look and feel, you can do one of these :
- create a custom
ValidationMessagec# class, and use your own css class (refer this SO answer) or use bootstrap css etc - quick and not so elegant fix, you can modify the
validation-messageclass in yourapp.cssor site.css file(s), so that it word wraps the lengthy error messages - create a custom validator
blazorcomponent (as in this)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Anand Sowmithiran |
