"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6997],{3905:function(e,t,n){n.d(t,{Zo:function(){return d},kt:function(){return u}});var a=n(7294);function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function r(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach((function(t){s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,a,s=function(e,t){if(null==e)return{};var n,a,s={},l=Object.keys(e);for(a=0;a<l.length;a++)n=l[a],t.indexOf(n)>=0||(s[n]=e[n]);return s}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a<l.length;a++)n=l[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}var o=a.createContext({}),c=function(e){var t=a.useContext(o),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},d=function(e){var t=c(e.components);return a.createElement(o.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,s=e.mdxType,l=e.originalType,o=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),m=c(n),u=s,g=m["".concat(o,".").concat(u)]||m[u]||p[u]||l;return n?a.createElement(g,r(r({ref:t},d),{},{components:n})):a.createElement(g,r({ref:t},d))}));function u(e,t){var n=arguments,s=t&&t.mdxType;if("string"==typeof e||s){var l=n.length,r=new Array(l);r[0]=m;var i={};for(var o in t)hasOwnProperty.call(t,o)&&(i[o]=t[o]);i.originalType=e,i.mdxType="string"==typeof e?e:s,r[1]=i;for(var c=2;c<l;c++)r[c]=n[c];return a.createElement.apply(null,r)}return a.createElement.apply(null,n)}m.displayName="MDXCreateElement"},2695:function(e,t,n){n.d(t,{Z:function(){return i}});var a=n(7462),s=n(3366),l=n(7294),r=["isBad","isGood","children","disableFullscreen","limitWidth"];function i(e){var t=e.isBad,n=e.isGood,i=e.children,o=e.disableFullscreen,c=e.limitWidth,d=(0,s.Z)(e,r),p=(0,l.useState)(!1),m=p[0],u=p[1];return l.createElement("div",{className:"preview-box-wrapper",style:c?{width:c,display:"table",margin:"0 auto"}:{}},!o&&l.createElement("button",{"aria-label":m?"Minimize the example":"Fullscreen the example",className:"preview-box-fullscreen-toggle",onClick:function(e){var t=e.target.closest(".preview-box-wrapper");m?document.exitFullscreen?document.exitFullscreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.msExitFullscreen&&document.msExitFullscreen():t.requestFullscreen?t.requestFullscreen():t.webkitRequestFullscreen?t.webkitRequestFullscreen():t.msRequestFullscreen&&t.msRequestFullscreen(),u(!m)}},m?l.createElement("svg",{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",x:"0",y:"0",viewBox:"0 0 24 24"},l.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"})):l.createElement("svg",{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",x:"0",y:"0",viewBox:"26 26 48 48"},l.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"}))),t&&l.createElement("div",{className:"is-bad-example style-red"},l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",x:"0",y:"0",viewBox:"2 2 12 12"},l.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&&l.createElement("div",{className:"is-good-example style-green"},l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",x:"0",y:"0",viewBox:"0 0 18 18"},l.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"}))),l.createElement("iframe",(0,a.Z)({width:"100%",className:"docus-preview-box"+(m?" is-fullscreen":""),srcDoc:i},d)))}},2491:function(e,t,n){n.r(t),n.d(t,{frontMatter:function(){return o},contentTitle:function(){return c},metadata:function(){return d},toc:function(){return p},default:function(){return u}});var a=n(7462),s=n(3366),l=(n(7294),n(3905)),r=n(2695),i=["components"],o={title:"Badges"},c=void 0,d={unversionedId:"components/badge",id:"components/badge",isDocsHomePage:!1,title:"Badges",description:"Badges",source:"@site/docs/components/badge.mdx",sourceDirName:"components",slug:"/components/badge",permalink:"/docs/components/badge",editUrl:"https://github.com/amir2mi/flatifycss/tree/master/website/docs/components/badge.mdx",tags:[],version:"current",frontMatter:{title:"Badges"},sidebar:"tutorialSidebar",previous:{title:"Backdrop layer",permalink:"/docs/components/backdrop-layer"},next:{title:"Breadcrumbs",permalink:"/docs/components/breadcrumbs"}},p=[{value:"Badges",id:"badges",children:[],level:2},{value:"Overlay badges",id:"overlay-badges",children:[],level:2},{value:"Customization",id:"customization",children:[],level:2}],m={toc:p};function u(e){var t=e.components,n=(0,s.Z)(e,i);return(0,l.kt)("wrapper",(0,a.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("h2",{id:"badges"},"Badges"),(0,l.kt)("p",null,"Use badges to show numbers, texts, or just as an icon to get user attention, badges get their size from parent font size either you can set a specific size."),(0,l.kt)(r.Z,{height:"190px",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>Badges</title> </head> <body> <p class="size-xs"> You have got new messages! <span class="badge style-green edge-circle pulse">+1</span> </p> <p class="size-md"> You have got new messages! <span class="badge style-orange edge-round-md pulse">+50</span> </p> <p class="size-2x"> You have got new messages! <span class="badge style-red edge-round-sm">+999</span> </p> </body>\n</html>\n',mdxType:"PreviewBox"}),(0,l.kt)("div",{className:"admonition admonition-info alert alert--info"},(0,l.kt)("div",{parentName:"div",className:"admonition-heading"},(0,l.kt)("h5",{parentName:"div"},(0,l.kt)("span",{parentName:"h5",className:"admonition-icon"},(0,l.kt)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,l.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"}))),"Badge pulse effect")),(0,l.kt)("div",{parentName:"div",className:"admonition-content"},(0,l.kt)("p",{parentName:"div"},(0,l.kt)("inlineCode",{parentName:"p"},".pulse")," is a helper class that gives animation to the element ",(0,l.kt)("inlineCode",{parentName:"p"},"::after")," so it will get users' attention where is it necessary."))),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-html",metastring:'{3,8,13} title="index.html"',"{3,8,13}":!0,title:'"index.html"'},'<p class="size-xs">\n  You have got new messages!\n  <span class="badge style-green edge-circle pulse">+1</span>\n</p>\n\n<p class="size-md">\n  You have got new messages!\n  <span class="badge style-orange edge-round-md pulse">+50</span>\n</p>\n\n<p class="size-2x">\n  You have got new messages!\n  <span class="badge style-red edge-round-sm">+999</span>\n</p>\n')),(0,l.kt)("h2",{id:"overlay-badges"},"Overlay badges"),(0,l.kt)("p",null,"Here is an example of badge over button:"),(0,l.kt)(r.Z,{height:"110px",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>Badges</title> <style> .my-button{ position: relative; min-width: 120px; margin: 10px; } .my-badge{ position: absolute; top: -2px; right: -2px } </style> </head> <body> <div class="flex-center"> <button class="my-button button bordered"> Help Us! <span class="my-badge badge style-red edge-circle pulse"></span> </button> <button class="my-button button bordered"> New Messages! <span class="my-badge badge style-blue edge-circle pulse">20</span> </button> </div> </body>\n</html>\n',mdxType:"PreviewBox"}),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-html",metastring:'title="index.html"',title:'"index.html"'},'<button class="my-button button bordered">\n  Help Us!\n  <span class="my-badge badge style-red edge-circle pulse"></span>\n</button>\n<button class="my-button button bordered">\n  New Messages!\n  <span class="my-badge badge style-blue edge-circle pulse">20</span>\n</button>\n')),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-css",metastring:'title="style.css"',title:'"style.css"'},".my-button {\n  position: relative;\n  min-width: 120px;\n  margin: 10px;\n}\n\n.my-badge {\n  position: absolute;\n  top: -2px;\n  right: -2px;\n}\n")),(0,l.kt)("h2",{id:"customization"},"Customization"),(0,l.kt)("p",null,"These are CSS variables for badges that you can use to customize the default colors or create new kind of badge:"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"--flatify__badge-txt-color"),(0,l.kt)("br",{parentName:"p"}),"\n",(0,l.kt)("inlineCode",{parentName:"p"},"--flatify__badge-bg-color")),(0,l.kt)(r.Z,{height:"140px",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>Badges</title> <style> .custom-badge{ --flatify__badge-txt-color: #fff; --flatify__badge-bg-color: linear-gradient(to right, #8a2387, #e94057, #f27121);\t } </style> </head> <body> <p> You have got new messages! <span class="badge custom-badge">+1</span> </p> <p> You have got new messages! <span class="badge custom-badge anim-hue">+1</span> </p> </body>\n</html>\n',mdxType:"PreviewBox"}),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-html",metastring:'title="index.html"',title:'"index.html"'},'<p>\n  You have got new messages!\n  <span class="badge custom-badge">+1</span>\n</p>\n\n<p>\n  You have got new messages!\n  <span class="badge custom-badge anim-hue">+1</span>\n</p>\n')),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-css",metastring:'title="style.css"',title:'"style.css"'},".custom-badge {\n  --flatify__badge-txt-color: #fff;\n  --flatify__badge-bg-color: linear-gradient(to right, #8a2387, #e94057, #f27121);\n}\n")))}u.isMDXComponent=!0}}]);