/
githubmirror
/
tabler
Обзор
Документация
Войти
/
githubmirror
/
tabler
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
docs/pages/ui/forms/form-validation.mdx
48 строк
2 KB
Paweł Kuna
Generate SCSS and JS docs snippets from source markers (#2798)
05 авг 2026, 19:44
Не верифицирован
05 авг 2026, 19:44
9c4dc73
Код
Авторство
О чём код?
--- title: Validation states summary: To inform users whether the entered value is correct or not, use either of the validation states. Thanks to that, users will immediately know which form elements they need to correct and, if the state displays as invalid, why the value is incorrect. description: Indicate valid or invalid inputs. layout: '@layouts/DocsMdxLayout.astro' --- import Example from '@components/Example.astro'; import CodeDocs from '@components/CodeDocs.astro'; ## Validation states To inform users whether the entered value is correct or not, use either of the validation states. Thanks to that, users will immediately know which form elements they need to correct and, if the state displays as invalid, why the value is incorrect. To apply the validation state to the form control, use the `.is-valid` and `.is-invalid` classes. <Example> <input type="text" class="form-control is-valid" placeholder="Valid State..." /> <input type="text" class="form-control is-invalid" placeholder="Invalid State..." /> </Example> ## Validation feedback To provide users with additional information about the validation state, you can use the `.valid-feedback` and `.invalid-feedback` classes. <Example> <div> <label class="form-label required">City</label> <input type="text" class="form-control is-invalid" required /> <div class="invalid-feedback">Please provide a valid city.</div> </div> </Example> You can also use the `.valid-feedback` to provide users with positive feedback. <Example> <div> <label class="form-label required">City</label> <input type="text" class="form-control is-valid" value="Warsaw" /> <div class="valid-feedback">Looks good!</div> </div> </Example> ## Subtle validation states If you prefer a more subtle manner of informing users of the input control validation state, you can use tick and cross symbols and refrain from using colored control frames and the validation feedback. To do this, use the `.is-valid-lite` and `.is-invalid-lite` classes. <Example> <input type="text" class="form-control is-valid is-valid-lite" placeholder="Valid State..." /> <input type="text" class="form-control is-invalid is-invalid-lite" placeholder="Invalid State..." /> </Example> ## SCSS variables Use these SCSS variables to customize form validation states. The default values are: <CodeDocs name="form-validation-variables" file="core/scss/_variables.scss" />