Preheat the oven to 350 degrees F (175 degrees C).
Place a steamer insert into a saucepan and fill with water to just below the bottom of the steamer. Bring water to a boil. Add broccoli, cover, and steam until tender, 2 to 4 minutes; drain well.
Melt butter in a saucepan over medium heat. Stir in flour until combined. Gradually whisk in milk, stirring constantly to prevent lumps. Cook until thickened, about 10 minutes.
Combine broccoli, mayonnaise, eggs, and onion in a 2-quart baking dish; stir in sauce to combine. Season with salt and black pepper.
Bake in the preheated oven for 30 minutes. Sprinkle Cheddar cheese on top; continue baking until center is set, about 15 minutes more.
Notes
This dish is a family favorite and is perfect for holiday gatherings.