+If the option C<with_optgroups> is set then this function expects
+C<\@collection> to be one level deeper. The upper-most level is
+translated into a HTML C<optgroup> tag. So the structure becomes:
+
+=over 4
+
+=item 1. Array of array references. Each element in the
+C<\@collection> is converted into an optgroup.
+
+=item 2. The optgroup's C<label> attribute will be set to the the
+first element in the array element. The second array element is then
+converted to a list of C<option> tags like it is described above.
+
+=back
+
+Example for use of optgroups:
+
+ # First in a controller:
+ my @collection = (
+ [ t8("First optgroup with two items"),
+ [ { id => 42, name => "item one" },
+ { id => 54, name => "second item" },
+ { id => 23, name => "and the third one" },
+ ] ],
+ [ t8("Another optgroup, with a lot of items from Rose"),
+ SL::DB::Manager::Customer->get_all_sorted ],
+ );
+
+ # Later in the template:
+ [% L.select_tag('the_selection', COLLECTION, with_optgroups=1, title_key='name') %]
+