What is the TypeScript definition for the onBlur event in React?

The right interface for onBlur is FocusEvent

Please continue reading below to see how to use it or read my guide on using React's events with TypeScript.

Interface

interface FocusEvent<T = Element> extends SyntheticEvent<T, NativeFocusEvent> {
    relatedTarget: EventTarget | null;
    target: EventTarget & T;
}

Full example

import React, { FocusEvent } from 'react';

const InputComponent = () => {
  const handleFocusEvent = (e: FocusEvent<HTMLInputElement>) => {
    // Do something
  };

  return <input value="Some text" onBlur={handleFocusEvent} />;
};

export default InputComponent;

Attributes that use FocusEvent: