{"id":82,"date":"2025-11-04T20:51:56","date_gmt":"2025-11-04T20:51:56","guid":{"rendered":"https:\/\/jaedpro.com\/wp-react-panel\/?post_type=docs&#038;p=82"},"modified":"2025-11-04T21:06:50","modified_gmt":"2025-11-04T21:06:50","password":"","slug":"field-type-checkbox","status":"publish","type":"docs","link":"https:\/\/jaedpro.com\/wp-react-panel\/docs\/field-type-checkbox\/","title":{"rendered":"Field Type: Checkbox"},"content":{"rendered":"\n<p>A group of checkboxes for selecting multiple options simultaneously.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Example Usage<\/h3>\n\n\n\n<div class=\"betterdocs-code-snippet-wrapper theme-light betterdocs-code-snippet-bf43f43c\"\n     id=\"betterdocs-code-snippet-bf43f43c\"\n     data-language=\"php\"\n     data-copy-button=\"true\">\n\n            <div class=\"betterdocs-code-snippet-header betterdocs-file-preview-header\">\n        <div class=\"betterdocs-file-preview-left\">\n                            <div class=\"betterdocs-traffic-lights\">\n                    <span class=\"traffic-light traffic-light-red\"><\/span>\n                    <span class=\"traffic-light traffic-light-yellow\"><\/span>\n                    <span class=\"traffic-light traffic-light-green\"><\/span>\n                <\/div>\n            \n            <div class=\"betterdocs-file-info\">\n                \n                                    <div class=\"betterdocs-file-name\">\n                        <span class=\"file-name-text\">sample-plugin.php<\/span>\n                    <\/div>\n                            <\/div>\n        <\/div>\n\n        <div class=\"betterdocs-file-preview-right\">\n                            <div class=\"betterdocs-code-snippet-copy-container\">\n                    <button class=\"betterdocs-code-snippet-copy-button\"\n                            type=\"button\"\n                            data-clipboard-target=\"#betterdocs-code-snippet-bf43f43c .betterdocs-code-snippet-code code\"\n                            aria-label=\"Copy code to clipboard\">\n                        <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                            <path d=\"M16 1H4C2.9 1 2 1.9 2 3V17H4V3H16V1ZM19 5H8C6.9 5 6 5.9 6 7V21C6 22.1 6.9 23 8 23H19C20.1 23 21 22.1 21 21V7C21 5.9 20.1 5 19 5ZM19 21H8V7H19V21Z\" fill=\"currentColor\"\/>\n                        <\/svg>\n                    <\/button>\n                                    <\/div>\n                    <\/div>\n        <\/div>\n    \n    <div class=\"betterdocs-code-snippet-content\">\n        \n        <pre class=\"betterdocs-code-snippet-code language-php\"><code>array(\n\t&#039;id&#039;       =&gt; &#039;notification_channels&#039;,\n\t&#039;title&#039;    =&gt; &#039;Notification Channels&#039;,\n\t&#039;subTitle&#039; =&gt; &#039;Select which channels should be enabled for notifications&#039;,\n\t&#039;type&#039;     =&gt; &#039;checkbox&#039;,\n\t&#039;options&#039;  =&gt; array(\n\t\t&#039;email_alerts&#039; =&gt; &#039;Email Alerts&#039;,\n\t\t&#039;sms_alerts&#039;   =&gt; &#039;SMS Alerts&#039;,\n\t\t&#039;push_alerts&#039;  =&gt; &#039;Push Notifications&#039;,\n\t\t&#039;in_app&#039;       =&gt; &#039;In-App Notifications&#039;,\n\t),\n\t&#039;default&#039;  =&gt; array( &#039;email_alerts&#039;, &#039;in_app&#039; ),\n\t&#039;value&#039;    =&gt; get_option( &#039;notification_channels&#039; ),\n),<\/code><\/pre>\n    <\/div>\n<\/div>\n\n<script type=\"text\/javascript\">\ndocument.addEventListener('DOMContentLoaded', function() {\n    \/\/ Initialize copy functionality for this specific snippet\n    const snippet = document.getElementById('betterdocs-code-snippet-bf43f43c');\n    if (snippet && window.BetterDocsCodeSnippet) {\n        window.BetterDocsCodeSnippet.initCopyButton(snippet);\n    }\n});\n<\/script>\n\n\n\n<h3 class=\"wp-block-heading\">Properties<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>id<\/strong> (required) &#8211; Unique identifier for the field<\/li>\n\n\n\n<li><strong>title<\/strong> (required) &#8211; Label displayed above the checkbox group<\/li>\n\n\n\n<li><strong>subTitle<\/strong> (optional) &#8211; Additional descriptive text below the title<\/li>\n\n\n\n<li><strong>type<\/strong> (required) &#8211; Must be <code>'checkbox'<\/code><\/li>\n\n\n\n<li><strong>options<\/strong> (required) &#8211; Associative array of <code>value => label<\/code> pairs<\/li>\n\n\n\n<li><strong>default<\/strong> (optional) &#8211; Array of default checked option keys<\/li>\n\n\n\n<li><strong>value<\/strong> (optional) &#8211; Array of currently checked options<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Notes<\/h3>\n\n\n\n<p>Always returns an array of selected values, even if only one checkbox is checked. Use radio buttons if you need single selection only.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A group of checkboxes for selecting multiple options simultaneously. Example Usage Properties Notes Always returns an array of selected values, even if only one checkbox is checked. Use radio buttons if you need single selection only.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"doc_category":[4],"doc_tag":[],"class_list":["post-82","docs","type-docs","status-publish","hentry","doc_category-field-types"],"blocksy_meta":[],"year_month":"2026-05","word_count":94,"total_views":0,"reactions":{"happy":0,"normal":0,"sad":0},"author_info":{"name":"Jaed Mosharraf","author_nicename":"jaedm97","author_url":"https:\/\/jaedpro.com\/wp-react-panel\/author\/jaedm97\/"},"doc_category_info":[{"term_name":"Field Types","term_url":"https:\/\/jaedpro.com\/wp-react-panel\/docs-category\/field-types\/"}],"doc_tag_info":[],"_links":{"self":[{"href":"https:\/\/jaedpro.com\/wp-react-panel\/wp-json\/wp\/v2\/docs\/82","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jaedpro.com\/wp-react-panel\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/jaedpro.com\/wp-react-panel\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/jaedpro.com\/wp-react-panel\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/jaedpro.com\/wp-react-panel\/wp-json\/wp\/v2\/comments?post=82"}],"version-history":[{"count":3,"href":"https:\/\/jaedpro.com\/wp-react-panel\/wp-json\/wp\/v2\/docs\/82\/revisions"}],"predecessor-version":[{"id":107,"href":"https:\/\/jaedpro.com\/wp-react-panel\/wp-json\/wp\/v2\/docs\/82\/revisions\/107"}],"wp:attachment":[{"href":"https:\/\/jaedpro.com\/wp-react-panel\/wp-json\/wp\/v2\/media?parent=82"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/jaedpro.com\/wp-react-panel\/wp-json\/wp\/v2\/doc_category?post=82"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/jaedpro.com\/wp-react-panel\/wp-json\/wp\/v2\/doc_tag?post=82"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}