Cut the MDF to 42.5" inches wide, to account for the width of the twin bed, and your desired height. Because the headboard will be hung on the wall behind your bed, it will need to be at least as tall as your head when you are sitting on the bed.
Measure and cut the foam to fit the size of your headboard and attach it to the front of the MDF using spray adhesive. This foam material will serve as headboard padding to ensure it is comfortable to lean against.
Measure the fabric to fit the headboard, adding an additional 3 to 6 inches on each side to account for wrapping the fabric across the full length of the foam and securing it on the back of the MDF. Because the headboard will be hung on the wall, the unfinished side will not be seen.
Attached the fabric to the headboard. Start by stapling at center points, then gradually work your way around. The fabric should be taut and wrinkle-free once you are done.
Trim the fabric along the back if necessary.
Use a stud finder to attach the mounting brackets to the wall and position the headboard into place behind the bed.