@@ -831,12 +831,12 @@ public static function option(string $value, string $text = "", array $props = [
831831 * OptionGroup Tag
832832 *
833833 * @param string $label Optgroup label
834- * @param string $text Text displayed to the user
834+ * @param string $children Element children
835835 * @param array $props Additional props
836836 */
837837 public static function optgroup (string $ label , array $ children = [], array $ props = []) {
838838 $ props ["label " ] = $ label ;
839- return self ::create_element ("option " , $ props , $ children );
839+ return self ::create_element ("optgroup " , $ props , $ children );
840840 }
841841
842842 /**
@@ -974,4 +974,19 @@ public static function _select(array $options, array $props = []) {
974974 }
975975 return self ::create_element ("select " , $ props , $ els );
976976 }
977+
978+ /**
979+ * custom OptionGroup Tag
980+ *
981+ * @param string $label Optgroup label
982+ * @param string $children Element children
983+ * @param array $props Additional props
984+ */
985+ public static function _optgroup (string $ label , array $ children = [], array $ props = []) {
986+ return self ::optgroup ($ label , [
987+ self ::loop ($ children , function ($ value , $ key ) {
988+ return self ::option ($ key , $ value );
989+ })
990+ ]);
991+ }
977992}
0 commit comments