ValyroUI English version

Form Field

Поле с валидацией и ошибками. Бесплатно, MIT · Формы и ввод › Форма целиком и фильтры

Установка

npx valyro-cli@latest add form-field
npx shadcn@latest add https://valyro.xyz/r/form-field.json
npm install valyro-ui

import 'valyro-ui/styles.css';
import { FormField } from 'valyro-ui';

Пропсы

PropTypeDefault
labelReactNodeText of the <label> above the control, linked to it by id. Or FormField.Label.
hintReactNodeHelper text under the control, linked via aria-describedby. Hidden while error is set. Or FormField.Description.
errorReactNodeError message; any truthy value marks the field invalid and replaces the hint. Or FormField.Error.
requiredbooleanfalseShows a required mark next to the label and tells screen readers: aria-required on the control, or the labels.required word in its description where its role has no aria-required.
counterReactNodeSlot at the end of the footer, e.g. a character counter "42/280".
children *ReactNodeA single control. It receives id, aria-describedby, aria-invalid and, for components, invalid. Or the compound form: FormField.Label, FormField.Control (around the control), FormField.Description, FormField.Error.
labelsPartial<FormFieldLabels>Overrides for the built-in English text; keys left out keep their defaults.

Составные части

FormField.Label (FormFieldLabel), FormField.Control (FormFieldControl), FormField.Description (FormFieldDescription), FormField.Error (FormFieldError)

Похожие компоненты

  • Multi-step Form — Пошаговая форма: валидация шагов, пропуск, проверка перед отправкой, черновик
  • Form Autosave Status — Статус автосохранения формы: офлайн, ошибка, конфликт версий и хук useAutosave
  • Filter Builder — Конструктор фильтров: вложенные группы И/ИЛИ, условия по типу поля, JSON и сводка
  • Filter Toolbar — Панель фильтров каталога: счётчик, выпадающие фильтры, сортировка, чипы
  • Text Input — Текстовые поля
  • Textarea — Многострочный ввод
  • Search Input — Поисковая строка
  • Mentions Input — Текст с @упоминаниями и #тегами, асинхронные подсказки
  • Tags Input — Ввод тегов
  • Select — Выбор из списка
  • Multi Select — Множественный выбор
  • Combobox — Поиск и выбор

Назад: Image Cropper · Далее: Multi-step Form · Весь раздел «Формы и ввод»