Skip to content

blank

Validates that a field is empty. The opposite of notEmpty.

Options

OptionTypeDefaultDescription
trimbooleanfalseIf true, trims whitespace before checking — " " becomes valid
messagestringlocale defaultCustom error message

Playground

Valid values

ValueNotes
""Empty string
" "Whitespace only (when trim: true)

Invalid values

ValueReason
"hello"Non-empty string
"0"The string "0" is not empty
" "Whitespace only (when trim: false, the default)

Notes

  • Common use case: honeypot fields — hidden inputs that should remain empty to detect bots.
  • Use trim: true if you want whitespace-only values to also be considered empty.

Released under the MIT License.