This CodeLet will make a single checkbox a require field. This is usefule when you are creating a checkbox in your custom module.

Make single checkbox a required field in Drupal | Drupal Developer
CodeLet

<?php
$form['terms_condition'] = array(
'#type' => 'checkboxes',
'#title' => t('Terms & condition'),
'#options' => array(
1 => t('I agree to Terms & condition'),
),
'#required' => TRUE,
);
?>

DrupalD
Enroll to Drupal 10 Training