Skip to content

Field

frontend-react/src/components/ui/Field.tsx

Form field wrapper that pairs a <label> with an input, shows required marker and inline error.

Props

PropTypeDescription
labelstringLabel text
requiredbooleanAppends * to label
errorstringInline error below input (role="alert")
childrenReactNodeThe input element

Usage

tsx
<Field label="Email" required error={errors.email}>
  <input type="email" id="email" />
</Field>

Notes

  • Auto-generates htmlFor/id from label if not provided
  • Error node uses role="alert" for screen reader compatibility

Lançado sob a licença MIT.