The Court upheld, under the Commerce Clause, the law passed by Congress allowing the civil commitment of mentally ill sex offenders after the completion of their criminal sentences.
https://www.scotusblog.com/case-files/cases/united-states-v-comstock/