{"id":7975,"date":"2020-03-09T14:54:33","date_gmt":"2020-03-09T14:54:33","guid":{"rendered":"http:\/\/putridparrot.com\/blog\/?p=7975"},"modified":"2020-03-09T14:54:33","modified_gmt":"2020-03-09T14:54:33","slug":"splitter-bars-in-react","status":"publish","type":"post","link":"https:\/\/putridparrot.com\/blog\/splitter-bars-in-react\/","title":{"rendered":"Splitter bars in React"},"content":{"rendered":"<p>I went through a load of splitter bar implementations for use within a React site, i.e. I simply wanted to partition my application into two halves (top and bottom), with a horizontal splitter bar.<\/p>\n<p>The top half should be filled with a grid of data (I was using ag-grid), the bottom half filled with the query builder control. Also the button half should be capable of being collapse\/hidden.<\/p>\n<p>I was surprised at how hard it was to find anything that &#8220;just worked&#8221;. But this one did&#8230;<\/p>\n<p>Run <\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\nyarn add m-react-splitters\r\n<\/pre>\n<p>Mine is <em>&#8220;m-react-splitters&#8221;: &#8220;^1.2.0&#8221;<\/em>. Now import the following<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\nimport Splitter from &quot;m-react-splitters&quot;;\r\nimport &quot;m-react-splitters\/lib\/splitters.css&quot;;\r\n<\/pre>\n<p>and here&#8217;s the basics for the code (obviously replacing the comment blocks with your components).<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\n&lt;Splitter\r\n   position=&quot;horizontal&quot;\r\n   maximizedPrimaryPane={!showQueryBuilder}&gt;\r\n&lt;div style={{width: &quot;100%, height: &quot;100%&quot; }}&gt;\r\n&lt;!-- grid --&gt;\r\n&lt;\/div&gt;\r\n&lt;div style={{width: &quot;100%, height: &quot;100%&quot;, overflow: &quot;auto&quot; }}&gt;\r\n&lt;!-- query builder --&gt;\r\n&lt;\/div&gt;\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I went through a load of splitter bar implementations for use within a React site, i.e. I simply wanted to partition my application into two halves (top and bottom), with a horizontal splitter bar. The top half should be filled with a grid of data (I was using ag-grid), the bottom half filled with the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[45,243],"tags":[],"class_list":["post-7975","post","type-post","status-publish","format-standard","hentry","category-javascript","category-react"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/7975","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/comments?post=7975"}],"version-history":[{"count":2,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/7975\/revisions"}],"predecessor-version":[{"id":7990,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/7975\/revisions\/7990"}],"wp:attachment":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/media?parent=7975"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/categories?post=7975"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/tags?post=7975"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}