How to query all content type and add as checkbox for custom form?
This was inspired from @leymannx comments. 

I changed the '#type' to checkboxes.

/**
 * {@inheritdoc}
 */
public function buildForm(array $form, FormStateInterface $form_state) {
 $types = \Drupal::entityTypeManager()
   -&gt;getStorage('node_type')
   -&gt;loadMultiple();

 foreach($types as $type) {
   $content_types[$type-&gt;id()] = $type-&gt;label();
 }

 // Need help setting this up so that the options are content types. 
 $form['enabled_content_types'] = [
   '#type' =&gt; 'checkboxes',
   '#title' =&gt; 'Enabled Content Types',
   '#description' =&gt; 'Run preprocess for all enabled content types only',
   '#options' =&gt; $content_types,
 ],
}