"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6683],{3905:function(t,e,n){n.d(e,{Zo:function(){return c},kt:function(){return m}});var a=n(7294);function l(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,a)}return n}function r(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?o(Object(n),!0).forEach((function(e){l(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function i(t,e){if(null==t)return{};var n,a,l=function(t,e){if(null==t)return{};var n,a,l={},o=Object.keys(t);for(a=0;a<o.length;a++)n=o[a],e.indexOf(n)>=0||(l[n]=t[n]);return l}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(a=0;a<o.length;a++)n=o[a],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(l[n]=t[n])}return l}var s=a.createContext({}),d=function(t){var e=a.useContext(s),n=e;return t&&(n="function"==typeof t?t(e):r(r({},e),t)),n},c=function(t){var e=d(t.components);return a.createElement(s.Provider,{value:e},t.children)},u={inlineCode:"code",wrapper:function(t){var e=t.children;return a.createElement(a.Fragment,{},e)}},b=a.forwardRef((function(t,e){var n=t.components,l=t.mdxType,o=t.originalType,s=t.parentName,c=i(t,["components","mdxType","originalType","parentName"]),b=d(n),m=l,p=b["".concat(s,".").concat(m)]||b[m]||u[m]||o;return n?a.createElement(p,r(r({ref:e},c),{},{components:n})):a.createElement(p,r({ref:e},c))}));function m(t,e){var n=arguments,l=e&&e.mdxType;if("string"==typeof t||l){var o=n.length,r=new Array(o);r[0]=b;var i={};for(var s in e)hasOwnProperty.call(e,s)&&(i[s]=e[s]);i.originalType=t,i.mdxType="string"==typeof t?t:l,r[1]=i;for(var d=2;d<o;d++)r[d]=n[d];return a.createElement.apply(null,r)}return a.createElement.apply(null,n)}b.displayName="MDXCreateElement"},2695:function(t,e,n){n.d(e,{Z:function(){return i}});var a=n(7462),l=n(3366),o=n(7294),r=["isBad","isGood","children","disableFullscreen","limitWidth"];function i(t){var e=t.isBad,n=t.isGood,i=t.children,s=t.disableFullscreen,d=t.limitWidth,c=(0,l.Z)(t,r),u=(0,o.useState)(!1),b=u[0],m=u[1];return o.createElement("div",{className:"preview-box-wrapper",style:d?{width:d,display:"table",margin:"0 auto"}:{}},!s&&o.createElement("button",{"aria-label":b?"Minimize the example":"Fullscreen the example",className:"preview-box-fullscreen-toggle",onClick:function(t){var e=t.target.closest(".preview-box-wrapper");b?document.exitFullscreen?document.exitFullscreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.msExitFullscreen&&document.msExitFullscreen():e.requestFullscreen?e.requestFullscreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen():e.msRequestFullscreen&&e.msRequestFullscreen(),m(!b)}},b?o.createElement("svg",{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",x:"0",y:"0",viewBox:"0 0 24 24"},o.createElement("path",{d:"M19.707 18.293a1 1 0 01-1.414 1.414L16 17.414V18a1 1 0 01-2 0v-3a1 1 0 011-1h3a1 1 0 010 2h-.586zM9 14H6a1 1 0 000 2h.586l-2.293 2.293a1 1 0 001.414 1.414L8 17.414V18a1 1 0 002 0v-3a1 1 0 00-1-1zm0-9a1 1 0 00-1 1v.586L5.707 4.293a1 1 0 00-1.414 1.414L6.586 8H6a1 1 0 000 2h3a1 1 0 001-1V6a1 1 0 00-1-1zm6 5h3a1 1 0 000-2h-.586l2.293-2.293a1 1 0 00-1.414-1.414L16 6.586V6a1 1 0 00-2 0v3a1 1 0 001 1z"})):o.createElement("svg",{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",x:"0",y:"0",viewBox:"26 26 48 48"},o.createElement("path",{d:"M54.347 57.882A8.96 8.96 0 0150 59a8.96 8.96 0 01-4.347-1.118L40.736 62.8c-.38.38-.257.701.29.701h.98A2.503 2.503 0 0144.5 66c0 1.39-1.122 2.5-2.507 2.5h-7.986a2.505 2.505 0 01-2.507-2.507v-7.986A2.502 2.502 0 0134 55.5a2.49 2.49 0 012.5 2.493v.98c0 .547.314.678.7.29l4.918-4.916A8.96 8.96 0 0141 50a8.96 8.96 0 011.118-4.347L37.2 40.736c-.38-.38-.701-.257-.701.29v.98A2.503 2.503 0 0134 44.5c-1.39 0-2.5-1.122-2.5-2.507v-7.986a2.505 2.505 0 012.507-2.507h7.986A2.502 2.502 0 0144.5 34a2.49 2.49 0 01-2.493 2.5h-.98c-.547 0-.678.314-.29.7l4.916 4.918A8.96 8.96 0 0150 41a8.96 8.96 0 014.347 1.118l4.917-4.917c.38-.38.257-.701-.29-.701h-.98A2.503 2.503 0 0155.5 34c0-1.39 1.122-2.5 2.507-2.5h7.986a2.505 2.505 0 012.507 2.507v7.986A2.502 2.502 0 0166 44.5a2.49 2.49 0 01-2.5-2.493v-.98c0-.547-.314-.678-.7-.29l-4.918 4.916A8.96 8.96 0 0159 50a8.96 8.96 0 01-1.118 4.347l4.917 4.917c.38.38.701.257.701-.29v-.98A2.503 2.503 0 0166 55.5c1.39 0 2.5 1.122 2.5 2.507v7.986a2.505 2.505 0 01-2.507 2.507h-7.986A2.502 2.502 0 0155.5 66a2.49 2.49 0 012.493-2.5h.98c.547 0 .678-.314.29-.7l-4.916-4.918zM50 54a4 4 0 100-8 4 4 0 000 8z"}))),e&&o.createElement("div",{className:"is-bad-example style-red"},o.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",x:"0",y:"0",viewBox:"2 2 12 12"},o.createElement("path",{d:"M3.3 12.7c.2.2.4.3.7.3s.5-.1.7-.3L8 9.4l3.3 3.3c.2.2.5.3.7.3s.5-.1.7-.3c.4-.4.4-1 0-1.4L9.4 8l3.3-3.3c.4-.4.4-1 0-1.4s-1-.4-1.4 0L8 6.6 4.7 3.3c-.4-.4-1-.4-1.4 0s-.4 1 0 1.4L6.6 8l-3.3 3.3c-.4.4-.4 1 0 1.4z"}))),n&&o.createElement("div",{className:"is-good-example style-green"},o.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",x:"0",y:"0",viewBox:"0 0 18 18"},o.createElement("path",{d:"M5.056 15.04a1.5 1.5 0 002.217-.119l10.17-12.476A1.5 1.5 0 0015.118.55L6.007 11.758l-3.453-3.41a1.5 1.5 0 10-2.109 2.133l4.611 4.56"}))),o.createElement("iframe",(0,a.Z)({width:"100%",className:"docus-preview-box"+(b?" is-fullscreen":""),srcDoc:i},c)))}},3446:function(t,e,n){n.r(e),n.d(e,{frontMatter:function(){return s},contentTitle:function(){return d},metadata:function(){return c},toc:function(){return u},default:function(){return m}});var a=n(7462),l=n(3366),o=(n(7294),n(3905)),r=n(2695),i=["components"],s={title:"Add button",sidebar_position:5},d=void 0,c={unversionedId:"components/buttons/add-button",id:"components/buttons/add-button",isDocsHomePage:!1,title:"Add button",description:"By adding .add-button to ` it will be a button with a plus sign, you can use this component for menus or other interactive elements. .active` class will change plus to minus.",source:"@site/docs/components/buttons/add-button.mdx",sourceDirName:"components/buttons",slug:"/components/buttons/add-button",permalink:"/docs/components/buttons/add-button",editUrl:"https://github.com/amir2mi/flatifycss/tree/master/website/docs/components/buttons/add-button.mdx",tags:[],version:"current",sidebarPosition:5,frontMatter:{title:"Add button",sidebar_position:5},sidebar:"tutorialSidebar",previous:{title:"Button group",permalink:"/docs/components/buttons/button-group"},next:{title:"Hamburger button",permalink:"/docs/components/buttons/hamburger"}},u=[{value:"Sizes",id:"sizes",children:[],level:3},{value:"Colors",id:"colors",children:[],level:3}],b={toc:u};function m(t){var e=t.components,n=(0,l.Z)(t,i);return(0,o.kt)("wrapper",(0,a.Z)({},b,n,{components:e,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"By adding ",(0,o.kt)("inlineCode",{parentName:"p"},".add-button")," to ",(0,o.kt)("inlineCode",{parentName:"p"},"<button>")," it will be a button with a plus sign, you can use this component for menus or other interactive elements. ",(0,o.kt)("inlineCode",{parentName:"p"},".active")," class will change plus to minus."),(0,o.kt)("div",{className:"admonition admonition-info alert alert--info"},(0,o.kt)("div",{parentName:"div",className:"admonition-heading"},(0,o.kt)("h5",{parentName:"div"},(0,o.kt)("span",{parentName:"h5",className:"admonition-icon"},(0,o.kt)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,o.kt)("path",{parentName:"svg",fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}))),"Accessibility matters!")),(0,o.kt)("div",{parentName:"div",className:"admonition-content"},(0,o.kt)("p",{parentName:"div"},"You do not need to add anything inside the add button element but it is necessary to set an ",(0,o.kt)("inlineCode",{parentName:"p"},"aria-label")," HTML attribute for accessibility purposes. ",(0,o.kt)("a",{parentName:"p",href:"https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-label_attribute"},"Read more about aria-label usage"),"."))),(0,o.kt)(r.Z,{height:"70px",children:'\n<!DOCTYPE html>\n<html lang="en"> <head> <meta charset="UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatifycss/dist/css/flatify.min.css" /> <title>Add button</title> <style> .add-button{ margin: 0 5px !important; } </style> </head> <body> <div class="flex-center"> <button class="add-button interactive" aria-label="Add"/></button> <button class="add-button" aria-label="Add"/></button> <button class="add-button active" aria-label="Remove"/></button> </div> </body> <script> var addButton = document.querySelector(".add-button.interactive"); addButton.addEventListener("click", () => { addButton.classList.toggle("active"); if(addButton.classList.contains("active")){ addButton.setAttribute("aria-label", "Remove"); }else{ addButton.setAttribute("aria-label", "Add"); } }); <\/script>\n</html>\n',mdxType:"PreviewBox"}),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-html",metastring:'title="index.html"',title:'"index.html"'},'<button class="add-button" aria-label="Add"/></button>\n<button class="add-button active" aria-label="Remove"/></button>\n')),(0,o.kt)("h3",{id:"sizes"},"Sizes"),(0,o.kt)("p",null,"To change the button size use ",(0,o.kt)("a",{parentName:"p",href:"/docs/helpers/size-setters"},"size setter classes"),".\nThese classes just set a ",(0,o.kt)("inlineCode",{parentName:"p"},"font-size")," property so it is possible to change it yourself by writing custom CSS."),(0,o.kt)(r.Z,{height:"130px",children:'\n<!DOCTYPE html>\n<html lang="en"> <head> <meta charset="UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatifycss/dist/css/flatify.min.css" /> <title>Add button</title> <style> .add-button{ margin: 0 5px !important; } </style> </head> <body> <div class="flex-center"> <button class="add-button size-xs" aria-label="Add"></button> <button class="add-button size-lg" aria-label="Add"></button> <button class="add-button size-2x" aria-label="Add"></button> <button class="add-button size-3x" aria-label="Add"></button> </div> </body>\n</html>\n',mdxType:"PreviewBox"}),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-html",metastring:'title="index.html"',title:'"index.html"'},'<button class="add-button size-xs" aria-label="Add"></button>\n<button class="add-button size-lg" aria-label="Add"></button>\n<button class="add-button size-2x" aria-label="Add"></button>\n<button class="add-button size-3x" aria-label="Add"></button>\n')),(0,o.kt)("h3",{id:"colors"},"Colors"),(0,o.kt)("p",null,"There are helper classes for styling elements like button, first read about ",(0,o.kt)("a",{parentName:"p",href:"/docs/helpers/color-setters"},"color setter classes")," for having button with diffrent background and text color."),(0,o.kt)(r.Z,{height:"100px",children:'\n<!DOCTYPE html>\n<html lang="en"> <head> <meta charset="UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatifycss/dist/css/flatify.min.css" /> <title>Add button</title> <style> .add-button{ margin: 0 5px !important; } </style> </head> <body> <div class="flex-center" style="flex-wrap: wrap"> <button class="add-button color-success" aria-label="Add"></button> <button class="add-button color-warning" aria-label="Add"></button> <button class="add-button color-purple" aria-label="Add"></button> <button class="add-button color-red" aria-label="Add"></button> </div> </body>\n</html>\n',mdxType:"PreviewBox"}),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-html",metastring:'title="index.html"',title:'"index.html"'},'<button class="add-button color-success" aria-label="Add"></button>\n<button class="add-button color-warning" aria-label="Add"></button>\n<button class="add-button color-purple" aria-label="Add"></button>\n<button class="add-button color-red" aria-label="Add"></button>\n')))}m.isMDXComponent=!0}}]);