NAME
    Data::HTML::Button - Data object for HTML button element.

SYNOPSIS
     use Data::HTML::Button;

     my $obj = Data::HTML::Button->new(%params);
     my $autofocus = $obj->autofocus;
     my $css_class = $obj->css_class;
     my $data = $obj->data;
     my $data_type = $obj->data_type;
     my $disabled = $obj->disabled;
     my $form = $obj->form;
     my $form_enctype = $obj->form_enctype;
     my $form_method = $obj->form_method;
     my $id = $obj->id;
     my $label = $obj->label;
     my $name = $obj->name;
     my $type = $obj->type;
     my $value = $obj->value;

METHODS
  "new"
     my $obj = Data::HTML::Button->new(%params);

    Constructor.

    Returns instance of object.

    *       "autofocus"

            Button autofocus flag.

            Default value is 0.

    *       "css_class"

            Button CSS class.

            Default value is undef.

    *       "data"

            Button data content. It's reference to array. Data type of data
            is described in 'data_type' parameter.

            Default value is [].

    *       "data_type"

            Button data type for content.

            Possible value are: plain tags

            Default value is 'plain'.

    *       "disabled"

            Button autofocus flag.

            Default value is 0.

    *       "form"

            Button form id.

            Default value is undef.

    *       "form_enctype"

            Button form encoding. It's valuable for 'submit' type.

            Possible values are: application/x-www-form-urlencoded
            multipart/form-data text/plain

            Default value is undef.

    *       "form_method"

            Button form method. It's valuable for 'submit' type.

            Possible values are: get post

            Default value is 'get'.

    *       "id"

            Button identifier.

            Default value is undef.

    *       "label"

            Button label.

            Default value is undef.

    *       "name"

            Button name.

            Default value is undef.

    *       "type"

            Button element type.

            Possible types: button reset submit

            Default value is 'button'.

    *       "value"

            Button value.

            Default value is undef.

  "autofocus"
     my $autofocus = $obj->autofocus;

    Get button autofocus flag.

    Returns bool value (1/0).

  "css_class"
     my $css_class = $obj->css_class;

    Get CSS class for button.

    Returns string.

  "data"
     my $data = $obj->data;

    Get data inside button element.

    Returns reference to array.

  "data_type"
     my $data_type = $obj->data_type;

    Get button data type.

    Returns string.

  "disabled"
     my $disabled = $obj->disabled;

    Get button disabled flag.

    Returns bool value (1/0).

  "form"
     my $form = $obj->form;

    Get button form id.

    Returns string.

  "form_enctype"
     my $form_enctype = $obj->form_enctype;

    Get button form enctype.

    Returns string.

  "form_method"
     my $form_method = $obj->form_method;

    Get button form method.

    Returns string.

  "id"
     my $id = $obj->id;

    Get button identifier.

    Returns string.

  "label"
     my $label = $obj->label;

    Get button label.

    Returns string.

  "name"
     my $name = $obj->name;

    Get button name.

    Returns string.

  "type"
     my $type = $obj->type;

    Get button type.

    Returns string.

  "value"
     my $value = $obj->value;

    Get button value.

    Returns string.

ERRORS
     new():
             Parameter 'autofocus' must be a bool (0/1).
                    Value: %s
             Parameter 'data_type' has bad value.
             Parameter 'disabled' must be a bool (0/1).
                    Value: %s
             Parameter 'form_enctype' has bad value.
                     Value: %s
             Parameter 'form_method' has bad value.
             Parameter 'type' has bad value.

EXAMPLE1
     use strict;
     use warnings;

     use Data::HTML::Button;

     my $obj = Data::HTML::Button->new;

     # Print out.
     print 'Data type: '.$obj->data_type."\n";
     print 'Form method: '.$obj->form_method."\n";
     print 'Type: '.$obj->type."\n";

     # Output:
     # Data type: plain
     # Form method: get
     # Type: button

EXAMPLE2
     use strict;
     use warnings;

     use Data::HTML::Button;
     use Tags::Output::Raw;

     my $obj = Data::HTML::Button->new(
             # Tags(3pm) structure.
             'data' => [
                     ['b', 'span'],
                     ['d', 'Button'],
                     ['e', 'span'],
             ],
             'data_type' => 'tags',
     );

     my $tags = Tags::Output::Raw->new;

     # Serialize data to output.
     $tags->put(@{$obj->data});
     my $data = $tags->flush(1);

     # Print out.
     print 'Data (serialized): '.$data."\n";
     print 'Data type: '.$obj->data_type."\n";
     print 'Form method: '.$obj->form_method."\n";
     print 'Type: '.$obj->type."\n";

     # Output:
     # Data (serialized): <span>Button</span>
     # Data type: tags
     # Form method: get
     # Type: button

EXAMPLE3
     use strict;
     use warnings;

     use Data::HTML::Button;

     my $obj = Data::HTML::Button->new(
             # Plain content.
             'data' => [
                     'Button',
             ],
             'data_type' => 'plain',
     );

     # Serialize data to output.
     my $data = join ' ', @{$obj->data};

     # Print out.
     print 'Data: '.$data."\n";
     print 'Data type: '.$obj->data_type."\n";
     print 'Form method: '.$obj->form_method."\n";
     print 'Type: '.$obj->type."\n";

     # Output:
     # Data: Button
     # Data type: plain
     # Form method: get
     # Type: button

DEPENDENCIES
    Error::Pure, List::Util, Mo, Mo::utils, Readonly.

REPOSITORY
    <https://github.com/michal-josef-spacek/Data-HTML-Button>

AUTHOR
    Michal Josef Špaček <mailto:skim@cpan.org>

    <http://skim.cz>

LICENSE AND COPYRIGHT
    © 2022 Michal Josef Špaček

    BSD 2-Clause License

VERSION
    0.02