Contempt hearings & due process

A district court can hold a party in contempt and impose sanctions when that party has disobeyed a court order. But did you know that there are two types of contempt, each requiring different due process procedures?
Direct contempt is when you disobey a court order in front of the court. In those instances, the court can hold you in contempt after a warning.
But indirect contempt happens when you disobey a court order outside of the presence of the court. In those instances, due process is required for the court to hold you in contempt if it believes you have disobeyed an order outside of its presence.
What does that due process require in cases of indirect contempt? It requires an affidavit and an opportunity to prepare and to present evidence in your defense.
So if you are a party being held in contempt of court for failure to obey a court order, the judge should give you proper notice and an opportunity to defend yourself before imposing sanctions. Otherwise, your due process rights have been violated, and you have a good issue on direct appeal.