How can I set some checkboxes to selected upon the first loading of the form? I have a form with checkboxes.

$form['my_checkboxes'] = [
    '#type' =&gt; 'checkboxes',
    '#options' =&gt; ['1' =&gt; 'one', '2' =&gt; 'two', '3' =&gt; 'three'],
];


And for example, I want to option '1' is selected upon form was loaded.

Could you clarify me, how can I set some checkboxes to selected upon the first loading of the form ?

Unfortunately, I couldn't find the solution in the examples module.
Use a #default_value:

$form['my_checkboxes'] = [
  '#type' =&gt; 'checkboxes',
  '#options' =&gt; ['1' =&gt; 'one', '2' =&gt; 'two', '3' =&gt; 'three'],
  '#default_value' =&gt; [1, 2],
];