MaterialComponents: checkbox_tag
authorSven Schöling <s.schoeling@googlemail.com>
Fri, 26 Mar 2021 18:22:31 +0000 (19:22 +0100)
committerSven Schöling <s.schoeling@googlemail.com>
Fri, 25 Jun 2021 13:51:32 +0000 (15:51 +0200)
SL/Presenter/MaterialComponents.pm

index a4eacc8..6259fe4 100644 (file)
@@ -285,6 +285,22 @@ sub select_tag {
   );
 }
 
+sub checkbox_tag {
+  my ($name, %attributes) = @_;
+
+  _set_id_attribute(\%attributes, $name);
+
+  my $label = $attributes{label}
+    ? html_tag('span', delete $attributes{label})
+    : '';
+
+  my $checkbox_html = SL::Presenter::Tag::checkbox_tag($name, %attributes);
+
+  html_tag('label',
+    $checkbox_html . $label,
+  );
+}
+
 
 1;
 __END__