<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Bernie January Jr.</title>
    <description>The latest articles on DEV Community by Bernie January Jr. (@janvierjr).</description>
    <link>https://dev.to/janvierjr</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F852750%2F1dd970b0-fc6a-4f6f-879d-f455d7aad105.jpeg</url>
      <title>DEV Community: Bernie January Jr.</title>
      <link>https://dev.to/janvierjr</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/janvierjr"/>
    <language>en</language>
    <item>
      <title>Web Accessibility</title>
      <dc:creator>Bernie January Jr.</dc:creator>
      <pubDate>Mon, 28 Aug 2023 13:36:56 +0000</pubDate>
      <link>https://dev.to/janvierjr/web-accessibility-4ad0</link>
      <guid>https://dev.to/janvierjr/web-accessibility-4ad0</guid>
      <description>&lt;p&gt;People have diverse abilities, skills, tools, preferences, and expectations that can impact how they use the Web.  &lt;/p&gt;

&lt;p&gt;I want to start by citing reference to stats I found via Sheri Byrne-Haber, a prominent inclusion leader and advocate for universal web accessibility.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Over 95% of the web is inaccessible to individuals who use assistive technologies and it takes approximately 8 seconds for them to make up their minds about whether they will continue or abandon that website or application.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Web accessibility means that websites, tools, and technologies are intentionally designed and developed so that people with disabilities can use them.&lt;/p&gt;

&lt;h3&gt;
  
  
  Creating accessible websites and apps reaches significantly more users.
&lt;/h3&gt;

&lt;p&gt;We can better reach users who may have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Permanent disabilities&lt;/strong&gt;, such as visual, mobility, cognitive or auditory impairments&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Temporary Disabilities&lt;/strong&gt;, such as a user with a broken or sprained finger or temporary vision loss due to lost glasses or contacts&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Situational Disabilities&lt;/strong&gt;, where for example, a parent might be cooking with one hand, holding a a child in another arm while trying to place an order on a website. OR something as common as low screen visibility due to bright sunlight&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Web Accessibility encompasses so much, I've included resources for more info at the end of this post. Because I can only scratch the surface here, I'll focus on 3 major accessibility considerations.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Perceivable Content
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Provide Text Alternatives for Non-Text Content
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Informative Images&lt;/strong&gt;: For images that convey information or content, provide concise, descriptive alt text.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;alt=”description of image”;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Complex Images&lt;/strong&gt;: If an image is complex and cannot be fully described in a few words, consider providing longer descriptions through &lt;code&gt;aria-describedby&lt;/code&gt; or linked descriptions.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;aria-describedby=&lt;/span&gt;&lt;span class="s"&gt;"delete-desc"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Add Friend&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;p&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"delete-desc"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;  Items that are deleted will be permanently removed immediately. Deleted items can no longer be accessed after deletion. &lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both &lt;code&gt;aria-labelledby&lt;/code&gt; and &lt;code&gt;aria-describedby&lt;/code&gt; reference other elements to calculate a text alternative, but a label should be concise, while a description is intended to provide more verbose information; a label describes the essence of an object, while a description provides more information that the user might need.&lt;/p&gt;

&lt;p&gt;The elements linked via &lt;code&gt;aria-describedby&lt;/code&gt; don't need to be visible. It is possible to reference an element even if that element is hidden. For example, a form control can have a description that is hidden by default that is revealed on request using a disclosure widget like a "more information" icon. The sighted user clicks on the icon; for assistive technology users the description is referenced from that form field directly with &lt;code&gt;aria-describedby&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Icons with Text Labels&lt;/strong&gt;: Whenever possible, pair icons with text labels. This helps users with different types of disabilities understand the context. Also, generally use &lt;strong&gt;ARIA Labels&lt;/strong&gt;: ARIA (which stands for Accessible Rich Internet Applications) labels to provide additional information about icons or graphics, if necessary.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;// The aria-label attribute defines a string value that labels an interactive element.
&lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;aria-label=&lt;/span&gt;&lt;span class="s"&gt;"Open"&lt;/span&gt; &lt;span class="na"&gt;onclick=&lt;/span&gt;&lt;span class="s"&gt;"modal.open()"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. Operable User Interface
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Keyboard Accessibility
&lt;/h3&gt;

&lt;p&gt;Keyboard accessibility is a fundamental aspect of web accessibility. It ensures that people with mobility impairments, especially those who cannot use a mouse, can navigate and interact with a website using only keyboard inputs.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Good HTML Semantics&lt;/strong&gt; &lt;br&gt;
includes the proper use of &lt;code&gt;nav&lt;/code&gt;, &lt;code&gt;section&lt;/code&gt;, &lt;code&gt;main&lt;/code&gt;, and heading tag hierarchy: &lt;code&gt;h1&lt;/code&gt; thru &lt;code&gt;h6&lt;/code&gt; tags. This allows for users to:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Skip Links&lt;/strong&gt;: &lt;br&gt;
skipping navigation links with a keydown of the 'tab' key at the beginning of the page allows users to jump directly to the &lt;code&gt;main&lt;/code&gt; content or important sections, bypassing navigation menus.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Tab Order&lt;/strong&gt;: &lt;br&gt;
Arrange the tab order of elements in a logical sequence that mirrors the visual layout. Users should be able to navigate through content in a predictable and intuitive manner. Setting tab orders: &lt;code&gt;tabindex="0"&lt;/code&gt; means that the element should be focusable in sequential keyboard navigation, after any positive &lt;code&gt;tabindex&lt;/code&gt; values. The focus navigation order of these elements is defined by their order in the document source.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;title&amp;gt;&lt;/span&gt;Parcel Sandbox&lt;span class="nt"&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;charset=&lt;/span&gt;&lt;span class="s"&gt;"UTF-8"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;

  &lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"app"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"overflow-hidden"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Click Here and start tabbing.&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;label&amp;gt;&lt;/span&gt;First in tab order:&lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&amp;lt;/label&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;tabindex=&lt;/span&gt;&lt;span class="s"&gt;"0"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Tabbable due to tabindex 0.&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;div&amp;gt;&lt;/span&gt;Not tabbable: no tabindex.&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;label&amp;gt;&lt;/span&gt;Third in tab order:&lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&amp;lt;/label&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;div&amp;gt;&lt;/span&gt;Not tabbable: no tabindex AGAIN.&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;tabindex=&lt;/span&gt;&lt;span class="s"&gt;"0"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Tabbable due to tabindex 0.&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;div&amp;gt;&lt;/span&gt;Not tabbable: no tabindex AGAIN.&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;tabindex=&lt;/span&gt;&lt;span class="s"&gt;"-1"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Not tabbable: due to tabindex -1 HERE.&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"./index.mjs"&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"module"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Focus indicators&lt;/strong&gt;: 
Ensure that interactive elements, such as links, buttons, and form fields, have visible focus indicators when they are highlighted using the keyboard. &lt;code&gt;focus-visible&lt;/code&gt; helps users understand where they are on the page and which element is currently selected.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;
&lt;span class="nt"&gt;input&lt;/span&gt;&lt;span class="nd"&gt;:focus-visible&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="nd"&gt;:focus-visible&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;outline&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="no"&gt;blueviolet&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;border-radius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;3px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Testing Accessibility Features
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Test the site or app with screen readers. Here's a great  screen reader demo by Mark Sutton of UC San Francisco: &lt;br&gt;
&lt;a href="https://www.youtube.com/watch?v=dEbl5jvLKGQ"&gt;https://www.youtube.com/watch?v=dEbl5jvLKGQ&lt;/a&gt; &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Test Type Colors v. Background Colors with a Contrast Checker: &lt;a href="https://webaim.org/resources/contrastchecker/"&gt;https://webaim.org/resources/contrastchecker/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Check the Accessibility of the website with an automated checker: &lt;a href="https://wave.webaim.org/"&gt;https://wave.webaim.org/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;User Testing and getting Feedback is ideal when launching any feature. Be sure to involve users with disabilities in testing. This is extremely important if we truly want to ensure user accessibility.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Keep Gathering feedback. Continue to make improvements and text compatibility with a variety of assistive technologies as these technologies evolve over time.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thanks for reading and I truly hope this was helpful.&lt;/p&gt;

&lt;h2&gt;
  
  
  Resources
&lt;/h2&gt;

&lt;p&gt;W3C: &lt;a href="https://www.w3.org/WAI/fundamentals/accessibility-intro/"&gt;https://www.w3.org/WAI/fundamentals/accessibility-intro/&lt;/a&gt; &lt;br&gt;
Quick reference: &lt;a href="https://www.w3.org/WAI/WCAG21/quickref/"&gt;https://www.w3.org/WAI/WCAG21/quickref/&lt;/a&gt; &lt;br&gt;
Contrast Checker: &lt;a href="https://webaim.org/resources/contrastchecker/"&gt;https://webaim.org/resources/contrastchecker/&lt;/a&gt;&lt;br&gt;
WCAG 2: checklist &amp;amp; standards: &lt;a href="https://webaim.org/standards/wcag/checklist"&gt;https://webaim.org/standards/wcag/checklist&lt;/a&gt; &lt;br&gt;
ADA.gov guidelines for web accessibility: &lt;a href="https://www.ada.gov/resources/web-guidance/"&gt;https://www.ada.gov/resources/web-guidance/&lt;/a&gt; &lt;br&gt;
UCSF screen reader demo: &lt;a href="https://www.youtube.com/watch?v=dEbl5jvLKGQ"&gt;https://www.youtube.com/watch?v=dEbl5jvLKGQ&lt;/a&gt; &lt;br&gt;
What do people with disabilities check when they first arrive on a website:  &lt;a href="https://www.youtube.com/watch?v=xYl2lAX-BTM"&gt;https://www.youtube.com/watch?v=xYl2lAX-BTM&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>a11y</category>
      <category>beginners</category>
      <category>css</category>
    </item>
    <item>
      <title>Why use Next.js?</title>
      <dc:creator>Bernie January Jr.</dc:creator>
      <pubDate>Mon, 14 Aug 2023 09:59:59 +0000</pubDate>
      <link>https://dev.to/janvierjr/why-use-nextjs-5c7l</link>
      <guid>https://dev.to/janvierjr/why-use-nextjs-5c7l</guid>
      <description>&lt;p&gt;Next.js is an open-source web framework created by &lt;a href="https://vercel.com/" rel="noopener noreferrer"&gt;Vercel&lt;/a&gt; and built on top of React. &lt;/p&gt;

&lt;p&gt;As you probably already know, React is a JavaScript library developed by Facebook for building user interfaces. React allows for the development of reusable UI components and application state management.&lt;/p&gt;

&lt;p&gt;So why would one use Next JS over just using React. Well, Next JS offers a few considerable upgrades that streamline the development process. Let's preview a few.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;But First, if you're interested in spinning up a quick Next.js app:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;run &lt;code&gt;npx create next-app &amp;lt;your-apps-name&amp;gt;&lt;/code&gt; in your terminal&lt;/li&gt;
&lt;li&gt;spinning the app up like this will prompt a series of question like if you want to use eslint, TypeScript, Pages Router, etc. Choose your preferences.&lt;/li&gt;
&lt;li&gt;cd into your app&lt;/li&gt;
&lt;li&gt;run &lt;code&gt;npm run dev&lt;/code&gt; in your terminal, which starts your Next.js app development server on port 3000&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Built-in Routing
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;THE ISSUE:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;React doesn't provide native routing capabilities. We have to use third-party libraries like React-Router to handle client-side routing, specifically when creating multi-page applications.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;THE SOLUTION:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Next.js introduces file-based routing, where the file structure of your project's "Pages" directory determines the routes. Each file in the Pages directory corresponds to a route.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When a file is added to the Pages directory, it's automatically available as a route.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz8lmgur3b8dxsjuq79zy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz8lmgur3b8dxsjuq79zy.png" alt="file based routing"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A Page is a React Component exported from a &lt;code&gt;.js&lt;/code&gt;, &lt;code&gt;.jsx&lt;/code&gt;, &lt;code&gt;.ts&lt;/code&gt;, or &lt;code&gt;.tsx&lt;/code&gt; file in the Pages directory. &lt;/p&gt;

&lt;p&gt;Each Page is associated with a route based on its file name. Let’s just import a Next.js Link component, export your functional React component/Page, and below we'll link our Page back to our home page: &lt;code&gt;index.js&lt;/code&gt; with the Link component.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;Link&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;next/link&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;Image&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;next/image&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Presentation&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h1&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Presentation&lt;/span&gt; &lt;span class="nx"&gt;Page&lt;/span&gt; &lt;span class="nx"&gt;without&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt; &lt;span class="nx"&gt;Router&lt;/span&gt; &lt;span class="kd"&gt;set&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;up&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h1&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h2&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Link&lt;/span&gt; &lt;span class="nx"&gt;href&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Back&lt;/span&gt; &lt;span class="nx"&gt;to&lt;/span&gt; &lt;span class="nx"&gt;home&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Link&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h2&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Image&lt;/span&gt; &lt;span class="nx"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/huh.jpg&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;425&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;375&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="nx"&gt;alt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;confused meme&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Server Side Rendering
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;THE ISSUE:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;React applications are typically client-side rendered (CSR), meaning the rendering of components happens on the browser side.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;THE SOLUTION:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Next.js offers built-in support for server-side rendering. Server-side rendering (SSR) is the process of rendering a web page on the server and sending the fully-rendered HTML to the client. A big benefit to SSR is that search engines can easily crawl and index pre-rendered HTML content. This leads to improved search engine ranking (easily improved SEO) and visibility for your pages, as compared to CSR where search engines might have difficulty indexing content that relies heavily on JavaScript.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Static Site Generation (SSG)
&lt;/h2&gt;

&lt;p&gt;SSG is a technique where the content of a web page is generated at build time and then served as static HTML files. This means that the server generates the HTML for each page before the application is deployed, and the same HTML is then sent to all users who visit that page. This can greatly improve site wide performance, as the server load is minimized, and users receive pre-rendered content without needing additional processing on the server or client side. This is particularly useful for serving static pages that all users see like: landing pages, e-commerce product listings, blog posts, etc.&lt;/p&gt;

&lt;h2&gt;
  
  
  Other Reasons to Try Next.js
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Next.js has automatic code-splitting: the process of splitting the application's bundle into smaller chunks required by each entry point. The goal is to improve the application's initial load time by only loading the code required to run that page.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Simplified data fetching with async/await in Server Components, and an extended fetch API for request memoization, data caching and revalidation.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Next.js automatically optimizes images with a built-in Image component that replaces img tags. Plus optimizations for Fonts and Scripts.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If you want a more streamlined development experience with fewer configuration requirements, peruse &lt;a href="https://nextjs.org/docs" rel="noopener noreferrer"&gt;the Next.js docs&lt;/a&gt;, which are truly user-friendly, to learn more about the aforementioned features and more.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Resources:
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Next.js Documentation&lt;/em&gt;&lt;/strong&gt; (beginner-friendly): &lt;a href="https://nextjs.org/docs" rel="noopener noreferrer"&gt;Link&lt;/a&gt;.&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Digital Ocean's&lt;/em&gt;&lt;/strong&gt;: reasons to use Next.js over Plain React: &lt;a href="https://www.youtube.com/watch?v=I-zhncvdEGU" rel="noopener noreferrer"&gt;Link&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I truly hope you found this info helpful.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>react</category>
      <category>beginners</category>
      <category>nextjs</category>
    </item>
    <item>
      <title>Motion UI in React</title>
      <dc:creator>Bernie January Jr.</dc:creator>
      <pubDate>Tue, 01 Aug 2023 04:48:13 +0000</pubDate>
      <link>https://dev.to/janvierjr/motion-ui-in-react-4oho</link>
      <guid>https://dev.to/janvierjr/motion-ui-in-react-4oho</guid>
      <description>&lt;p&gt;Motion UI refers to the use of animations, transitions, and visual effects to add movement and dynamism to user interfaces. It involves animating various elements, such as buttons, menus, cards, and page transitions, to create an interactive and engaging experience for users.&lt;/p&gt;

&lt;p&gt;There are many animation libraries and techniques that leverage React's declarative nature to define and manage animations in a straightforward and efficient way. I'll touch more on that later.&lt;/p&gt;

&lt;h2&gt;
  
  
  Planning Motion UI for Your React Application
&lt;/h2&gt;

&lt;p&gt;Proper planning ensures that your animations serve a purpose, enhance user experience, and align with your app's overall design and functionality. Here are a few key steps to consider when planning Motion UI for your React app:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Identify the Right Use Cases:&lt;/strong&gt;&lt;br&gt;
Begin by identifying areas in your React app where motion adds value. Not all components or interactions require animations, so focus on those that can benefit from clear visual feedback or improved user engagement. Common use cases include &lt;em&gt;page transitions, form validation, loading states, navigation menus, hover effects, and interactive elements&lt;/em&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Understand User Expectations and App Requirements&lt;/strong&gt;:&lt;br&gt;
Consider your target audience and their preferences when it comes to animations. Some users might appreciate subtle animations, while others might prefer more pronounced effects. Align the animations with an overall user experience strategy to ensure they enhance functionality rather than distract from it. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Set Clear Goals:&lt;/strong&gt;&lt;br&gt;
Define the objectives you want to achieve with animations. Animations may aim to improve usability, guide users through complex processes, provide visual feedback, or simply add aesthetic value.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Choosing the Right Animation Library
&lt;/h2&gt;

&lt;p&gt;Two of the most popular animation libraries for React include &lt;strong&gt;React Spring&lt;/strong&gt; [&lt;a href="https://github.com/pmndrs/react-spring" rel="noopener noreferrer"&gt;26.1k+ GitHub stars&lt;/a&gt;] and &lt;strong&gt;Framer Motion&lt;/strong&gt; [&lt;a href="https://github.com/framer/motion" rel="noopener noreferrer"&gt;19.6k+ GitHub stars&lt;/a&gt;], but there are many to choose from. Arafat Islam has a great list of animation libraries &lt;a href="https://dev.to/arafat4693/best-animation-libraries-for-react-156n"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;React Spring&lt;/strong&gt; is a physics-based animation library that excels in creating smooth and lifelike animations. It uses spring animations to achieve natural motion, useful for a wide range of animation types: simple transitions to more complex interactions. React Spring is known for its performance optimizations, allowing developers to create visually appealing animations without sacrificing speed. &lt;a href="https://www.react-spring.dev/docs" rel="noopener noreferrer"&gt;Documentation Link&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Framer Motion&lt;/strong&gt; provides a flexible and intuitive API for creating various animations and transitions. It is popular due to its ease of use and visual editor support. Framer Motion allows developers to create animations using keyframes, gestures, and more, making it a versatile option for a variety of animations. &lt;a href="https://www.framer.com/motion/" rel="noopener noreferrer"&gt;Documentation Link&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Common Use Cases and Considerations
&lt;/h2&gt;

&lt;p&gt;Using Framer motion, let's demo a couple of examples:&lt;/p&gt;

&lt;p&gt;A. &lt;strong&gt;Creating Smooth Transitions&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Using easing functions to achieve natural motion&lt;/li&gt;
&lt;li&gt;Avoiding abrupt or jerky animations&lt;/li&gt;
&lt;li&gt;Implementing staggered animations for a polished look&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Demo: Progress Scroll Bar&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl08ypnjfkbqt4rxwd2u7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl08ypnjfkbqt4rxwd2u7.png" alt="progress scroll bar"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// Import motion and useScroll from Framer Motion.&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;motion&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;useScroll&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;framer-motion&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Scroll&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// useScroll hook from framer JS AND By default, useScroll tracks the page scroll&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;scrollYProgress&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useScroll&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="cm"&gt;/** The core of Motion is the motion component. Think of it as a plain HTML or SVG element, supercharged with animation capabilities. */&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;motion&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;
        &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;progress-bar&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
        &lt;span class="nx"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{{&lt;/span&gt; &lt;span class="na"&gt;scaleX&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;scrollYProgress&lt;/span&gt; &lt;span class="p"&gt;}}&lt;/span&gt;
      &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h1&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Demo&lt;/span&gt; &lt;span class="nx"&gt;time&lt;/span&gt;&lt;span class="o"&gt;!&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h1&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;Scroll&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;B. &lt;strong&gt;Enhancing User Interactions&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Animating user interface elements during interactions&lt;/li&gt;
&lt;li&gt;Adding visual feedback for better user understanding&lt;/li&gt;
&lt;li&gt;Implementing drag-and-drop animations and gestures&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Demo: Responsive Accordion&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnqtjw7sozldcxyvfpt8j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnqtjw7sozldcxyvfpt8j.png" alt="Responsive Accordion"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// Import motion, AnimatePresence, LayoutGroup from Framer Motion.&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;motion&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;AnimatePresence&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;LayoutGroup&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;framer-motion&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Item&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;color&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;isOpen&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;motion&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;li&lt;/span&gt; &lt;span class="nx"&gt;animate&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="nx"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{{&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;--choiceColor&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;color&lt;/span&gt; &lt;span class="p"&gt;}}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;motion&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;animate&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;image&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="cm"&gt;/** AnimatePresence allows components to animate out when they're removed from the React tree. AnimatePresence works by detecting when direct children are removed from the React tree. Any motion components contained by the removed child that have an exit prop will fire that animation before the entire tree is finally removed from the DOM.*/&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;AnimatePresence&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;isOpen&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Content&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/AnimatePresence&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/motion.li&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Content&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;motion&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;animate&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;content&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="cm"&gt;/** The core of Motion is the motion component. Think of it as a plain HTML or SVG element, supercharged with animation capabilities. */&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;motion&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;span&lt;/span&gt;
        &lt;span class="nx"&gt;initial&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{{&lt;/span&gt; &lt;span class="na"&gt;opacity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="p"&gt;}}&lt;/span&gt;
        &lt;span class="nx"&gt;animate&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{{&lt;/span&gt; &lt;span class="na"&gt;opacity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="p"&gt;}}&lt;/span&gt;
        &lt;span class="nx"&gt;exit&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{{&lt;/span&gt; &lt;span class="na"&gt;opacity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="p"&gt;}}&lt;/span&gt;
        &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;        &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="cm"&gt;/** initial, animate, and exit properties set start, animation, and end animation state */&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;motion&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;span&lt;/span&gt;
        &lt;span class="nx"&gt;initial&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{{&lt;/span&gt; &lt;span class="na"&gt;opacity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="p"&gt;}}&lt;/span&gt;
        &lt;span class="nx"&gt;animate&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{{&lt;/span&gt; &lt;span class="na"&gt;opacity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="p"&gt;}}&lt;/span&gt;
        &lt;span class="nx"&gt;exit&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{{&lt;/span&gt; &lt;span class="na"&gt;opacity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="p"&gt;}}&lt;/span&gt;
        &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;motion&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;span&lt;/span&gt;
        &lt;span class="nx"&gt;initial&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{{&lt;/span&gt; &lt;span class="na"&gt;opacity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="p"&gt;}}&lt;/span&gt;
        &lt;span class="nx"&gt;animate&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{{&lt;/span&gt; &lt;span class="na"&gt;opacity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="p"&gt;}}&lt;/span&gt;
        &lt;span class="nx"&gt;exit&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{{&lt;/span&gt; &lt;span class="na"&gt;opacity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="p"&gt;}}&lt;/span&gt;
        &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/motion.div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;App&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;currentColor&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setColor&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="cm"&gt;/** LayoutGroup is a Group of motion components that should perform layout animations together. */&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;LayoutGroup&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;motion&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ul&lt;/span&gt; &lt;span class="nx"&gt;animate&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;colors&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;color&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Item&lt;/span&gt;
              &lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;color&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
              &lt;span class="nx"&gt;color&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;color&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
              &lt;span class="nx"&gt;isOpen&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;currentColor&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;color&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
              &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;setColor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;currentColor&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;color&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;color&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;
            &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;          &lt;span class="p"&gt;))}&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/motion.ul&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/LayoutGroup&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;colors&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#0099ff&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#ff0055&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#000&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;C. &lt;strong&gt;Responsive Motion Design&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Designing animations for various screen sizes and devices&lt;/li&gt;
&lt;li&gt;Utilizing media queries to adjust animation behavior&lt;/li&gt;
&lt;li&gt;Testing animations across different devices and browsers&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Debugging and Testing Motion UI
&lt;/h2&gt;

&lt;p&gt;Debugging and testing Motion UI in your React app is crucial to ensure that animations work as intended and provide a seamless user experience. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Animation Timing and Delays&lt;/strong&gt;:&lt;br&gt;
Check for correct animation timing and delays. Ensure that animations start and end at the appropriate times and that delays are consistent. Animation timing should be consistent and on par with branding consistency as all animated elements should have similar timing conventions as well as look and feel.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Performance and Optimization&lt;/strong&gt;:&lt;br&gt;
Evaluate the performance of animations. Measure and analyze their impact on rendering and overall app performance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Accessibility Testing and Considerations&lt;/strong&gt;&lt;br&gt;
Test animations for accessibility. Ensure that users with disabilities can understand and interact with the UI even if they cannot perceive the animations. Use ARIA attributes for screen reader compatibility and provide alternative options for users who may have motion sensitivity.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I hope this article was helpful.&lt;/p&gt;

&lt;p&gt;Below are some resources that might continue to be helpful:&lt;/p&gt;

&lt;h2&gt;
  
  
  Resources
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Framer Motion : Documentation &lt;a href="https://www.framer.com/motion/" rel="noopener noreferrer"&gt;Link&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Afarat Islam's: Best Animation Libraries for React &lt;a href="https://dev.to/arafat4693/best-animation-libraries-for-react-156n"&gt;Link&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Framer Motion Github: &lt;a href="https://github.com/framer/motion" rel="noopener noreferrer"&gt;Link&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>react</category>
      <category>webdev</category>
      <category>ui</category>
    </item>
    <item>
      <title>CSS Best Practices</title>
      <dc:creator>Bernie January Jr.</dc:creator>
      <pubDate>Mon, 19 Jun 2023 13:59:12 +0000</pubDate>
      <link>https://dev.to/janvierjr/css-best-practices-g41</link>
      <guid>https://dev.to/janvierjr/css-best-practices-g41</guid>
      <description>&lt;h2&gt;
  
  
  How does CSS work:
&lt;/h2&gt;

&lt;p&gt;Cascading Style Sheets (CSS) is unique amongst the programming languages. Knowing why it works the way it does may help in understanding why it's sometimes difficult to wrangle. Credit goes to &lt;a href="https://youtu.be/aHUtMbJw8iA"&gt;Miriam Suzanne&lt;/a&gt; for my better general understanding of it.&lt;/p&gt;

&lt;p&gt;The web, specifically the network of HTML documents we call the web, was created to be device agnostic, which just means that anyone on any device can view web HTML documents. In other words, the client-side (a website end user) controls the display of our webpage. Think different devices: phones, tablets, desktop computers, different browsers, different settings, and different user needs: screen readers, assistive devices, etc. A webpage or application today must be adaptive and shape shift to fit the shape of our users client-side customizations.&lt;/p&gt;

&lt;p&gt;The ‘Cascade’ in CSS takes all of these sources of information and defines a set of rules for how our web presentation renders in the browser. So when writing CSS, you’re sort of suggesting how output SHOULD look on an end user’s screen. It’s very different than designing for print, where we dictate the exact output of what our end user sees and receives. CSS can seem to act weird because it is resilient and adaptive by design. When CSS attributes fail, the browser is told to ignore them. CSS is an optional decorator for which parts can and intentionally fail to preserve our webpage’s content. &lt;/p&gt;

&lt;h2&gt;
  
  
  Reset CSS:
&lt;/h2&gt;

&lt;p&gt;We all know that CSS has more than a few weird quirks that can feel buggy and slow down your workflow. We can get around some of these ‘bugs’, by what many call a CSS reset. &lt;/p&gt;

&lt;p&gt;The most notable CSS reset is probably &lt;a href="https://meyerweb.com/eric/tools/css/reset/"&gt;this one&lt;/a&gt; created by Eric Meyers some years ago. I found out about this reset through another CSS legendary resource: Kevin Powell. If you want to learn more about CSS, I definitely recommend checking out his &lt;a href="https://www.youtube.com/channel/UCJZv4d5rbIKd4QHMPkcABCw"&gt;YouTube channel&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;For me… the Meyer’s reset is a bit wordy and exceeds the needs of my projects. I cherry-pick the resets that I utilize most here:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;margin: 0&lt;/strong&gt; for everything.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="c"&gt;/* resetting CSS margin: remove default margin on text tags */&lt;/span&gt;
&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;box-sizing: border-box&lt;/strong&gt; tells the browser to account for any border and padding in the values you specify for an element's width and height.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="c"&gt;/*
  Use a more-intuitive box-sizing model.
*/&lt;/span&gt;
&lt;span class="o"&gt;*,&lt;/span&gt;
&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nd"&gt;::before&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nd"&gt;::after&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;box-sizing&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;border-box&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;font: inherit&lt;/strong&gt;: I hate having to deal with the default fonts for button, input, textarea, and select elements. You can fix this by having it inherit whatever font you set your body to.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="c"&gt;/* remove built-in form typography
margin: remove default margin on text tags
*/&lt;/span&gt;
&lt;span class="nt"&gt;input&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;span class="nt"&gt;textarea&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;span class="nt"&gt;select&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;font&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;inherit&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;overflow-wrap: break-word&lt;/strong&gt;: There’s almost never a time when you’d want your text to overflow outside of the container div you place it within.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="c"&gt;/*
  Avoid text overflows
*/&lt;/span&gt;
&lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;span class="nt"&gt;h2&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;span class="nt"&gt;h3&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;span class="nt"&gt;h4&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;span class="nt"&gt;h5&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;span class="nt"&gt;h6&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;overflow-wrap&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;break-word&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Organize Your CSS
&lt;/h2&gt;

&lt;p&gt;By organization, I really mean to stress = Consistency. Consistency is everything. It will speed up your workflow, reduce debugging, and make edits easier. And, there are always edits.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;It’s best practice to keep unique component css files separate so that you separate your styling logic just as you would your component logic: &lt;code&gt;app.css&lt;/code&gt;, &lt;code&gt;sidebar.css&lt;/code&gt;, &lt;code&gt;navbar.css&lt;/code&gt;, etc.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Even if you have a single &lt;code&gt;style.css&lt;/code&gt; file, be sure to separate global css i.e. css that impacts tags like body, h1, p, etc. and local css i.e. &lt;code&gt;.nav-buttons&lt;/code&gt;, &lt;code&gt;#nav-title&lt;/code&gt;, &lt;code&gt;#nav-bar&lt;/code&gt;… it's best-practice to keep like with like.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use :root variables for often used styles like color, font-size, and font-family. This makes for easy color look-up/auto fill and worry-free consistency with your design brief and prototype UI.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="c"&gt;/* //// ROOT VARIABLES  */&lt;/span&gt;
&lt;span class="nd"&gt;:root&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="py"&gt;--black&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#000000&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="py"&gt;--teal&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#86FDF1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="py"&gt;--light-blue&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#C9D6EA&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="py"&gt;--violet&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#52489C&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="py"&gt;--yellow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#FFD449&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="py"&gt;--white&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#F7F3F3&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="py"&gt;--title-font&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;vollkorn&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;serif&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="py"&gt;--primary-font&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;system-ui&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;sans-serif&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="py"&gt;--secondary-font&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Georgia&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;serif&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="py"&gt;--lg-font&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2.5rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="py"&gt;--md-font&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="py"&gt;--sm-font&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;.5rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c"&gt;/* //// GLOBAL | site-wide */&lt;/span&gt;

&lt;span class="nt"&gt;body&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--black&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nl"&gt;font-family&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--primary-font&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Comment Your CSS
&lt;/h2&gt;

&lt;p&gt;Create comments in your CSS, trust me…. you or the developer who will update the project in the future will appreciate it.&lt;/p&gt;

&lt;p&gt;CSS Comment:&lt;br&gt;
&lt;code&gt;/* This is a CSS comment*/&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;It’s common convention to add a block of comments between sections of your stylesheet, helping you to differentiate between sections at a glance. If you use a string that won’t appear in your code, you can easily jump from section to section i.e. &lt;code&gt;////&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="c"&gt;/* //// ROOT VARIABLES  */&lt;/span&gt;

&lt;span class="c"&gt;/* //// GLOBAL | site-wide */&lt;/span&gt;

&lt;span class="c"&gt;/* //// HEADER + NAV  */&lt;/span&gt;

&lt;span class="c"&gt;/* //// MAIN  */&lt;/span&gt;

&lt;span class="c"&gt;/* //// FOOTER  */&lt;/span&gt;

&lt;span class="c"&gt;/* //// MEDIA QUERIES  */&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Accessible HTML/CSS:
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Follow Title Tag Hierarchy&lt;/strong&gt;: It's best practice to only have one h1 tag per page and to follow title tag hierarchy h1 &amp;gt; h2 &amp;gt; h3 &amp;gt; h4 &amp;gt; h5 &amp;gt; h6 as screen readers and search engines recognize HTML title tags.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Alt attributes&lt;/strong&gt;: Be sure to provide descriptive alt text for all your non-decorative images. Individuals that require or prefer to use screen readers to traverse your website or app will have image context and will have better User Experience (UX) with descriptive alt text. It’s also important for Search Engine Optimization (SEO). Generally speaking, creating a more accessible product makes for better UX for all users.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;img id="meme" src="img/viral-meme-squat-squint-woman.webp" alt="A viral meme of a woman squatting and squinting in a stylish pink blazer, gold hoop earrings, and heels trying to figure out why you didn't place ALT text in your image tag"/&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;ARIA states and properties&lt;/strong&gt;: &lt;a href="https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label"&gt;ARIA attributes&lt;/a&gt; allow developers a way to modify an element’s states and properties as defined in the accessibility tree. Some of the most common attributes are:&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;aria-label&lt;/code&gt;: defines a string value that labels an interactive element. It describes an action that one might expect of a particular element. A button that closes your navigation menu might look like this:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="nx"&gt;aria&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;label&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="err"&gt;“&lt;/span&gt;&lt;span class="nx"&gt;close&lt;/span&gt;&lt;span class="err"&gt;”&lt;/span&gt; &lt;span class="nx"&gt;on&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;click&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="err"&gt;”&lt;/span&gt;&lt;span class="nx"&gt;navMenu&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;close&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="err"&gt;”&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;aria-selected&lt;/code&gt;: indicates the current "selected" state for gridcell, option, row and tab roles. If true, the selectable element is selected and when false, vice versa.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;tab-interface&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;role&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;tablist&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;aria&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;label&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Sample Tabs&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;span&lt;/span&gt;
      &lt;span class="nx"&gt;role&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;tab&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
      &lt;span class="nx"&gt;aria&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;selected&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;true&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
      &lt;span class="nx"&gt;aria&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;controls&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;panel-1&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
      &lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;tab-1&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
      &lt;span class="nx"&gt;tabindex&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;0&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nx"&gt;First&lt;/span&gt; &lt;span class="nx"&gt;Tab&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/span&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;span&lt;/span&gt;
      &lt;span class="nx"&gt;role&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;tab&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
      &lt;span class="nx"&gt;aria&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;selected&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;false&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
      &lt;span class="nx"&gt;aria&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;controls&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;panel-2&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
      &lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;tab-2&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
      &lt;span class="nx"&gt;tabindex&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;-1&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nx"&gt;Second&lt;/span&gt; &lt;span class="nx"&gt;Tab&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/span&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Test Your Media Queries:
&lt;/h2&gt;

&lt;p&gt;Match your media queries to common device dimensions AND TEST IT!&lt;br&gt;
Also, Media Queries always go at the end of the CSS file per convention&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="n"&gt;only&lt;/span&gt; &lt;span class="n"&gt;screen&lt;/span&gt; &lt;span class="n"&gt;and&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;600px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nt"&gt;body&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;lightblue&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here are typical screen sizes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="c"&gt;/* Extra small devices (phones, 600px and down) */&lt;/span&gt;
&lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="n"&gt;only&lt;/span&gt; &lt;span class="n"&gt;screen&lt;/span&gt; &lt;span class="n"&gt;and&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;600px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="o"&gt;...&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;


&lt;span class="c"&gt;/* Small devices (portrait tablets and large phones, 600px and up) */&lt;/span&gt;
&lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="n"&gt;only&lt;/span&gt; &lt;span class="n"&gt;screen&lt;/span&gt; &lt;span class="n"&gt;and&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;min-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;600px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="o"&gt;...&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;


&lt;span class="c"&gt;/* Medium devices (landscape tablets, 768px and up) */&lt;/span&gt;
&lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="n"&gt;only&lt;/span&gt; &lt;span class="n"&gt;screen&lt;/span&gt; &lt;span class="n"&gt;and&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;min-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;768px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="o"&gt;...&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;


&lt;span class="c"&gt;/* Large devices (laptops/desktops, 992px and up) */&lt;/span&gt;
&lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="n"&gt;only&lt;/span&gt; &lt;span class="n"&gt;screen&lt;/span&gt; &lt;span class="n"&gt;and&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;min-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;992px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="o"&gt;...&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;


&lt;span class="c"&gt;/* Extra large devices (large laptops and desktops, 1200px and up) */&lt;/span&gt;
&lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="n"&gt;only&lt;/span&gt; &lt;span class="n"&gt;screen&lt;/span&gt; &lt;span class="n"&gt;and&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;min-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1200px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="o"&gt;...&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For orientation: landscape v. portrait (the default):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@media only screen and (orientation: landscape) {
  body {
    background-color: lightblue;
  }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I hope this was helpful. Thanks for reading.&lt;/p&gt;

&lt;p&gt;Below is a list of Resources that might continue to be helpful.&lt;/p&gt;

&lt;h2&gt;
  
  
  Resources
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;em&gt;CSS MDN docs&lt;/em&gt;: &lt;a href="https://developer.mozilla.org/en-US/docs/Learn/CSS/First_steps/How_CSS_works"&gt;link&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Miriam Suzanne's&lt;/em&gt;: explanation of why CSS is so weird: &lt;a href="https://youtu.be/aHUtMbJw8iA"&gt;link&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Eric Meyer's&lt;/em&gt;: THE CSS reset: &lt;a href="https://meyerweb.com/eric/tools/css/reset/"&gt;link&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Kevin Powell's&lt;/em&gt;: Youtube Channel to learn CSS: &lt;a href="https://www.youtube.com/channel/UCJZv4d5rbIKd4QHMPkcABCw"&gt;link&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;The Box Model MDN docs&lt;/em&gt;: &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Box_Model/Introduction_to_the_CSS_box_model"&gt;link&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;ARIA attributes MDN docs&lt;/em&gt;: &lt;a href="https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label"&gt;link&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>beginners</category>
      <category>css</category>
    </item>
    <item>
      <title>Intro to TypeScript</title>
      <dc:creator>Bernie January Jr.</dc:creator>
      <pubDate>Mon, 12 Jun 2023 13:50:44 +0000</pubDate>
      <link>https://dev.to/janvierjr/intro-to-typescript-5dhi</link>
      <guid>https://dev.to/janvierjr/intro-to-typescript-5dhi</guid>
      <description>&lt;p&gt;TypeScript(TS) is essentially JavaScript, with sugar on top… a Superset of JavaScript(JS). Because of this, whatever code you’d write in a JS file would be legit in a TS file. &lt;/p&gt;

&lt;p&gt;JavaScript was created in just 10 days, by Brendan Eich, an employee of Netscape at the time. Yeah, 10 days. &lt;/p&gt;

&lt;p&gt;When JavaScript was built, its intended purpose was to create small snippets of code that can be embedded into a webpage, which still happens of course. Today, in addition to JS embeds, developers and software engineers create full-stack web applications that can be written almost entirely in JavaScript.&lt;/p&gt;

&lt;p&gt;The language exponentially outgrew its initial scope, and there are more than a few odd quirks and buggy occurrences that may surprise even an experienced developer. For example:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JavaScript’s equality operator (==)&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="err"&gt;“”&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// logs &amp;gt;&amp;gt; true // that can’t be right?&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;JavaScript property access&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;square&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="na"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;sqArea&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;square&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;widht&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;square&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;sqArea&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// logs  &amp;gt;&amp;gt; NaN // Ok, I'm not the best speller. NaN, really? Shouldn't this log an error?&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;TypeScript was created to solve these sorts of problems in JavaScript.&lt;/p&gt;

&lt;h2&gt;
  
  
  Static Type Checking in TS
&lt;/h2&gt;

&lt;p&gt;TypeScript’s core benefit is static type checking, which simply means it will check for an error in your type values without you having to run your code.  TS forces JS to act like a statically-typed programming language. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;C++ Example: Statically-Typed Programming Languages:&lt;/strong&gt;&lt;br&gt;
A statically-typed programing language like C++, C# or Java requires different types of variables that explicitly define and store each type of value. A variable that stores an integer in the programming language C++ might look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;int&lt;/span&gt; &lt;span class="nx"&gt;num&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// declaring a C++ variable as an integer&lt;/span&gt;
&lt;span class="nx"&gt;num&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="err"&gt;“&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="err"&gt;”&lt;/span&gt; &lt;span class="c1"&gt;// NOPE can’t reassign an integer to a string in C++&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, the variable &lt;code&gt;num&lt;/code&gt; can’t be assigned to a string or any other value that is not a whole number, in fact the number can’t even include a decimal because there’s a different type of variable for floating point numbers called &lt;code&gt;double&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JavaScript Example: A Dynamically-typed Programming Language:&lt;/strong&gt;&lt;br&gt;
In JavaScript, variables are dynamic and declared at runtime / when the code executes. Variables can also change or be reassigned. As you already know, for example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;num&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// declaring a JS variable&lt;/span&gt;
&lt;span class="nx"&gt;num&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="err"&gt;“&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="err"&gt;”&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// OK reassigning a JS variable from a number to a string // JS is 100% ok with this &lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, let’s run &lt;code&gt;Math.round()&lt;/code&gt; on our &lt;code&gt;num&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// logs &amp;gt;&amp;gt; NaN // This result is frustrating when you have dozens or hundreds of lines of code in your codebase. You’re now chasing down the value for: num.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Again, TS is trying to solve potential bugs from the code above. &lt;/p&gt;

&lt;h2&gt;
  
  
  Defining Types in TS
&lt;/h2&gt;

&lt;p&gt;Let’s take advantage of TS static type checking. To do so, we’ll need to define our types explicitly upon declaration like we would in a statically-typed programming language. A demo perhaps… Below is a side-by-side comparison of functions. One written in JavaScript syntax and the same function in TypeScript, where we explicitly define the function’s type arguments.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JavaScript:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;calcArea&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;radius&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mf"&gt;3.14&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;radius&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;radius&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// from grade school // π r² &lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;calcArea&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// logs &amp;gt;&amp;gt; 78.5 // that’s what I expected&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;calcArea&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="err"&gt;‘&lt;/span&gt;&lt;span class="nx"&gt;answer&lt;/span&gt;&lt;span class="err"&gt;’&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// log &amp;gt;&amp;gt; NaN // again with this &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;TypeScript:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;calcArea&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;radius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mf"&gt;3.14&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;radius&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;radius&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// from grade school // π r² &lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;calcArea&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// logs &amp;gt;&amp;gt; 78.5 // again, expected&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;calcArea&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="err"&gt;‘&lt;/span&gt;&lt;span class="nx"&gt;answer&lt;/span&gt;&lt;span class="err"&gt;’&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// logs &amp;gt;&amp;gt; Error message // now that’s more like it &lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In TypeScript, you can declare any variable types that you could declare in JavaScript, and bonus, there are a few additional variable types.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Types in Javascript:&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;number, string, boolean, null, undefined, object&lt;/em&gt;&lt;br&gt;
&lt;strong&gt;Typescript includes the above and adds:&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;any, unknown, never, enum, tuple&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Examples of TS with Type Variables&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;numeric&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;123&lt;/span&gt;&lt;span class="nx"&gt;_456_789&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// type of number&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;words&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Typescript&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// type of string&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;blog_published&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;boolean&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// type of boolean&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;stringsArray&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt; &lt;span class="c1"&gt;// type of array with strings&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;person&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;bernie&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="c1"&gt;// type of tuple // array with 2 values / flaw with push method&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;anything&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// type any // can be any type // should rarely be used&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;calcTax&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;income&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt; &lt;span class="c1"&gt;// function with type of number arguments&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;income&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In VSCode, you can simply hover on a TS variable or TS function invocation and see what type value is expected before running the function. The Typescript compiler catches these type errors before runtime.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5oc5cO0X--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t4jm5yom2vm45b8hz3pj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5oc5cO0X--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t4jm5yom2vm45b8hz3pj.png" alt="Typescript catches errors before runtime" width="800" height="314"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  In Conclusion
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Structure Made for Teams&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;While on the surface, it may seem like it will take more time writing your code in TS versus JS. Let’s imagine the likely scenario where you’re working with a team of developers on a project. Working on a JavaScript project with a team can sometimes feel like hosting a party where every guest speaks a different language. &lt;/p&gt;

&lt;p&gt;And what if you’re working in a codebase you’re unfamiliar with and/or a large codebase, in addition to working with a team... This is a situation ripe for miscommunication and misunderstandings i.e. less effective use of time and more collective time debugging.&lt;/p&gt;

&lt;p&gt;With TS type definitions and clear interfaces, TypeScript comes to the party keeping everything nice and tidy AND takes on the role of universal translator. TypeScript helps structure your codebase with known values thereby making it easier to maintain. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Resources&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;TypeScript Docs&lt;/strong&gt;: The best resource usually lies within the core documentation. The TypeScript docs are organized in a way that both beginners and experienced developers can find what they're looking for. Here is a link to the &lt;a href="https://www.typescriptlang.org/"&gt;TypeScript Documentation&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;TS Setup in less than 10mins&lt;/strong&gt; | I’d highly recommend watching Alex Ziskind’s YouTube video called &lt;a href="https://www.youtube.com/watch?v=4zdBk6wisxc"&gt;TypeScript Set-up in VSCode&lt;/a&gt;. He does a really good job of taking things step-by-step in less than 10mins.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;TS Deep Dive in about 1 hour&lt;/strong&gt; | The Programming with Mosh channel from software engineer Mosh Hamedani rarely misses, and Mosh does a great job of explaining TypeScript from nuts to bolts in this 1 hour tutorial: &lt;a href="https://www.youtube.com/watch?v=d56mG7DezGs"&gt;TypeScript in 1 Hour&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I hope this was helpful. Happy coding!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Customizing your Webflow site with jQuery</title>
      <dc:creator>Bernie January Jr.</dc:creator>
      <pubDate>Fri, 05 May 2023 18:57:03 +0000</pubDate>
      <link>https://dev.to/janvierjr/customizing-your-webflow-site-with-jquery-19ib</link>
      <guid>https://dev.to/janvierjr/customizing-your-webflow-site-with-jquery-19ib</guid>
      <description>&lt;p&gt;If you’re a designer or web developer and you haven’t yet given Webflow a try, you’re missing out… especially if you’re familiar with jQuery. &lt;/p&gt;

&lt;h2&gt;
  
  
  First things first. What is Webflow?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://webflow.com/" rel="noopener noreferrer"&gt;Webflow&lt;/a&gt; is a unique website building platform used by over a million designers/developers to design modern web experiences with minimal to no code. The Webflow interface allows you to design highly customized web layouts, CSS animations, and frontend visuals in HTML, CSS and JavaScript, without actually having to write every line of code yourself. Also, Webflow has an amazing cadre of curated tutorials via &lt;a href="https://university.webflow.com/" rel="noopener noreferrer"&gt;Webflow University&lt;/a&gt; and a supportive community of designers/developers that can be found on YouTube, blogs, and the like.&lt;/p&gt;

&lt;h2&gt;
  
  
  So, why jQuery if Webflow writes the code for us?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://jquery.com/" rel="noopener noreferrer"&gt;jQuery&lt;/a&gt; is a rich, popular JavaScript library that makes things like DOM manipulation and event handling much simpler and easier to read. Also, Webflow automatically loads jQuery into all web projects so you don’t even have to import it.&lt;/p&gt;

&lt;p&gt;In my experience, it is totally possible to design a great website in Webflow without writing a single line of code. &lt;/p&gt;

&lt;p&gt;But… There are a number of instances when it’s easier, faster, and better to write just a few lines of jQuery. There might be situations where your design vision or site functionality would otherwise require a scale back without a bit of code. We’ll walk through a few Webflow-specific examples in a bit. &lt;/p&gt;

&lt;p&gt;But… Why jQuery when we could just write JavaScript? &lt;/p&gt;

&lt;p&gt;Okay, here’s a quick demo. Let’s say you want to add a ‘click’ event listener to a &lt;code&gt;&amp;lt;button&amp;gt;&lt;/code&gt; element. When the button is clicked, text is added to a &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt; paragraph element. &lt;/p&gt;

&lt;p&gt;As opposed to writing something like this:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;paragraph&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;appear-on-click&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;button&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;click&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;paragraph&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;innerHTML&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Button has been clicked with JavaScript!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;You could write less code with arguably more readable jQuery… for instance:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;$paragraph&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#appear-on-click&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nf"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;button&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;click&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;$paragraph&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Button as been clicked with jQuery!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Again, Webflow already loads the jQuery library on every site automatically.&lt;/p&gt;

&lt;p&gt;Before the Click Event:&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv20qjpl3nwany9eoamia.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv20qjpl3nwany9eoamia.png" alt="Before Click Event"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After the Click Event:&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5t0pyfsux5b44wkqy7o4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5t0pyfsux5b44wkqy7o4.png" alt="After Click Event"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Disable Body Scroll with Open Menu Click
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;First use case for using jQuery in Webflow:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When creating a custom navigation menu in Webflow, there are a few features you’ll likely want to add to the menu that make the navigation experience more user friendly. One of the most common is to disable page scroll while the navigation menu is open. Here’s how you could handle that.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;CREATE ‘scroll-disabled’ CLASS:&lt;/strong&gt; Inside the Webflow designer, select the body element. You’ll want to add a class of ‘scroll-disabled’ to the body element. Then set that class to Overflow hidden. Then REMOVE that class by clicking backspace/delete within the style selector.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvzbyhppcut2mf64y10t8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvzbyhppcut2mf64y10t8.png" alt="Webflow Interface for setting a class"&gt;&lt;/a&gt; &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;ADD jQuery TO PAGE:&lt;/strong&gt; Inside the Webflow designer toolbar within the section titled ‘Before &lt;code&gt;&amp;lt;/body&amp;gt;&lt;/code&gt; tag’, just drop this jQuery function. Be sure to replace the placeholder class name below with the class name of your button. Just click publish in the Webflow designer, and voila! &lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;

&lt;span class="c1"&gt;// replace '.menu-btn-class-here' with the class name of your menu button element and use the jQuery .click method to add a ‘click’ event listener&lt;/span&gt;
&lt;span class="nf"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;.menu-btn-class-here&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;click&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="c1"&gt;// use jQuery .toggleClass method to add and remove the 'scoll-disabled' class on click&lt;/span&gt;
  &lt;span class="nf"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;body&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;toggleClass&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;scroll-disabled&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;em&gt;FYI: Custom code changes added before the page’s closing body tag section will NOT appear in preview BUT will be made to the live staging site after being published.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Close Menu when User Clicks Off Menu
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Second use case for using jQuery in Webflow:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here’s another custom navigation menu feature that is easy to fix with a few lines of jQuery. When creating a custom navigation menu, you’ll want users to be able to close the open menu when they click anywhere outside the menu itself. This provides another way for users to close the menu without actually clicking the close menu button. This really simple feature improves the user experience a ton.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;ADD jQuery TO PAGE:&lt;/strong&gt; Again… Inside the Webflow designer toolbar within the section titled ‘Before &lt;code&gt;&amp;lt;/body&amp;gt;&lt;/code&gt; tag’, just drop this jQuery function. Be sure to replace the placeholder class names below with your actual class names. Just click publish in the Webflow designer, and voila! &lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;

&lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nx"&gt;Again&lt;/span&gt; &lt;span class="nx"&gt;use&lt;/span&gt; &lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="nx"&gt;jQuery&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;click&lt;/span&gt; &lt;span class="nx"&gt;method&lt;/span&gt; &lt;span class="nx"&gt;on&lt;/span&gt; &lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="nx"&gt;element&lt;/span&gt; &lt;span class="kd"&gt;with&lt;/span&gt; &lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;name&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="nx"&gt;your&lt;/span&gt; &lt;span class="nx"&gt;background&lt;/span&gt; &lt;span class="nx"&gt;div&lt;/span&gt;
&lt;span class="nf"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;.background-class-name-here&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;click&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="c1"&gt;// replace '.menu-btn-class-here' with the class name of your menu button element&lt;/span&gt;
 &lt;span class="nf"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;.menu-btn-class-here&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;click&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;em&gt;FYI it’s important that your menu &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; element is not (nested within) a child  of the background &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; element as any click on or off the menu element would glitch and close the menu.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;There are so many opportunities to upgrade your Webflow site with just a little bit of jQuery. Thanks for reading!&lt;/p&gt;

&lt;p&gt;If you’re yearning for more, here are a couple of great resources that I personally reference often:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Timothy Ricks | an amazing Webflow Developer. Here’s a &lt;a href="https://www.youtube.com/watch?v=BkoSPoXbpb4" rel="noopener noreferrer"&gt;link&lt;/a&gt; to his YouTube tutorial on using jQuery in Webflow. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;FinSweet | an amazing go-to for everything Webflow. Here’s a &lt;a href="https://finsweet.com/hacks-jquery" rel="noopener noreferrer"&gt;link&lt;/a&gt; to their page with some great jQuery hacks and tutorials.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>beginners</category>
      <category>jquery</category>
      <category>design</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Intro to Web Animations</title>
      <dc:creator>Bernie January Jr.</dc:creator>
      <pubDate>Mon, 27 Jun 2022 12:24:33 +0000</pubDate>
      <link>https://dev.to/janvierjr/intro-to-web-animations-oec</link>
      <guid>https://dev.to/janvierjr/intro-to-web-animations-oec</guid>
      <description>&lt;p&gt;Everyone loves web animations. Why? because they provide users with perceptual context so that digital interactions look and feel like physical, real-world ones. &lt;/p&gt;

&lt;p&gt;That being said… one shouldn’t ambush their users with animations that don’t enhance the user’s experience. The best web animations have real-world feel, are well-timed, and demonstrate purpose.&lt;/p&gt;

&lt;h2&gt;
  
  
  Purpose-driven Web Animations:
&lt;/h2&gt;

&lt;p&gt;Web Animations or Motion UI ideally supports usability. Here are a few goals to keep usability in mind:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Reinforce what our user &lt;strong&gt;EXPECTS&lt;/strong&gt; to happen minimizing the gap between user expectations and experience. i.e. Clicking on a hamburger menu should expand a user’s next available options.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Guides users through a continual &lt;strong&gt;NARRATIVE&lt;/strong&gt; of events, or a series of scenes we create that culminates in the user experience of the product. i.e. using scroll-in animations to guide the user experience narrative. &lt;a href="https://climatehistory.webflow.io/"&gt;For Example&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Develop &lt;strong&gt;CONSISTENT&lt;/strong&gt; relationships between web elements to guide user understanding. i.e. create a system for how animations engage users by, for example, building consistent button hover events in regards to potential color change, timing, and easing (we’ll focus more on Easing below).&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Using Animation or Motion UI to Guide User Experience:
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Provide a Visual Response&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Animations that reveal state transitions indicating that an interaction has taken place and gives users a response for their engagement. Hover on a button. Color change on a link. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qsib2LO4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/73spykum5aatyfl4dgr9.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qsib2LO4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/73spykum5aatyfl4dgr9.gif" alt="button hover effect" width="800" height="600"&gt;&lt;/a&gt; image credit:&lt;a href="https://dribbble.com/NikolaPopovic"&gt;Nikola Popovic&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Emphasize Elements for User Engagement&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Animations that bring attention to specific elements to draw users in towards engagement. An indicator to click. A Call-to-Action horizontal scroll banner. A chatbot nudge. An toggle arrow to keep scrolling. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Guide User Focus: Hide / Reveal&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;Animations that are called upon when information is needed. Navigation menu. Appear on Scroll web elements. Expandable / Collapsable tabs. Elements that reveal themselves upon page scroll. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8PekrybK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zgeu9vbhiedupjjg9g46.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8PekrybK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zgeu9vbhiedupjjg9g46.gif" alt="Hamburger Menu" width="539" height="369"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Importance of Timing
&lt;/h2&gt;

&lt;p&gt;Most importantly, no animation or motion UI interaction should take more time than a user might reasonably expect. Creating interactions that have long load-times may cause users to disengage with your content, or just keep scrolling, or in the worst case, leave the page or app entirely.&lt;/p&gt;

&lt;p&gt;There’s also a key difference between realtime interactions and delayed Interactions.&lt;/p&gt;

&lt;p&gt;A real-time interaction or ‘direct manipulation’ is when the user is engaging with web elements directly and those elements respond immediately. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--St-rlrSx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mmd000j587pvwogrcvyz.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--St-rlrSx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mmd000j587pvwogrcvyz.gif" alt="real-time animation" width="800" height="600"&gt;&lt;/a&gt;image credit: &lt;a href="https://www.uxinmotion.com/"&gt;UX in Motion&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;A delayed interaction occur after user input is received, and momentarily pauses the user’s direct engagement until after the interaction transitions. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rwOtYbG9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l0todo3xwvjeizqwjchs.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rwOtYbG9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l0todo3xwvjeizqwjchs.gif" alt="delayed animation" width="800" height="600"&gt;&lt;/a&gt;image credit: &lt;a href="https://www.uxinmotion.com/"&gt;UX in Motion&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Principles of Motion:
&lt;/h2&gt;

&lt;p&gt;The 12 Principles of Motion draws its origins from the 12 Principles of Animation… and I mean animation in the traditional cartoon definition of the word. The principles of animation have been used by Disney animators since the 1930s and were outlined by Ollie Johnson and Frank Thomas in a book called The Illusion of Life: Disney Animation in 1981. While similar conceptually to the Principles of Animation, the Principles of Motion focus on animated interactions that drive user engagement and usability. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--snl_vRyU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ipw87t0201tuxza39oid.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--snl_vRyU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ipw87t0201tuxza39oid.gif" alt="12 Principles of Motion" width="800" height="338"&gt;&lt;/a&gt; image credit: &lt;a href="https://www.uxinmotion.com/"&gt;UX in Motion&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you’re really curious about UX motion, I encourage you to follow &lt;a href="https://medium.com/@ux_in_motion"&gt;Issara Willenskomer&lt;/a&gt;, the founder of UX in Motion, and read more about the 12 Principles of Motion in &lt;a href="https://medium.com/ux-in-motion/creating-usability-with-motion-the-ux-in-motion-manifesto-a87a4584ddc"&gt;Issara’s post here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Easing Animations in CSS
&lt;/h2&gt;

&lt;p&gt;Starting with the basics and probably the most commonly utilized principle, let’s use CSS transition properties to demonstrate the Easing interactions on few div elements. Again, timing is everything. Here's a little easing &lt;a href="https://easings.net/"&gt;cheatsheet&lt;/a&gt; to help.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;ease&lt;/code&gt; - specifies a transition effect with a slow start, then fast, then end slowly (this is default)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ease-in&lt;/code&gt; - specifies a transition effect with a slow start&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ease-out&lt;/code&gt; - specifies a transition effect with a slow end&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ease-in-out&lt;/code&gt; - specifies a transition effect with a slow start and end&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  EASING Code Example with CSS:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;style&amp;gt;&lt;/span&gt; 
&lt;span class="nt"&gt;div&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;border-radius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;50%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#0075F2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;transition&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;width&lt;/span&gt; &lt;span class="m"&gt;1.5s&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;margin-bottom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1em&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;margin-left&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2em&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;text-align&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;line-height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;font-family&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;'Franklin Gothic Medium'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;'Arial Narrow'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Arial&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;sans-serif&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;medium&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#FFEAEE&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="nd"&gt;:hover&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;700px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nt"&gt;h1&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#0075F2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;font-family&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;'Franklin Gothic Medium'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;'Arial Narrow'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Arial&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;sans-serif&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nf"&gt;#cir2&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;transition-timing-function&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;ease&lt;/span&gt;&lt;span class="p"&gt;;}&lt;/span&gt;
&lt;span class="nf"&gt;#cir3&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;transition-timing-function&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;ease-in&lt;/span&gt;&lt;span class="p"&gt;;}&lt;/span&gt;
&lt;span class="nf"&gt;#cir4&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;transition-timing-function&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;ease-out&lt;/span&gt;&lt;span class="p"&gt;;}&lt;/span&gt;
&lt;span class="nf"&gt;#cir5&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;transition-timing-function&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;ease-in-out&lt;/span&gt;&lt;span class="p"&gt;;}&lt;/span&gt;


&lt;span class="nt"&gt;&amp;lt;/style&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;CSS transition-timing-function Property&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Hover over the div elements below, to see the different speed curves:&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"cir2"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;EASE&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&amp;lt;br&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"cir3"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;EASE-IN&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&amp;lt;br&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"cir4"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;EASE-OUT&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&amp;lt;br&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"cir5"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;EASE-IN-OUT&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&amp;lt;br&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;What you see in the browser:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SRTb_yaW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f768l35i18494yibj2rf.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SRTb_yaW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f768l35i18494yibj2rf.gif" alt="Demonstrate Easing with CSS" width="430" height="339"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Get Inspired. Follow other creators.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I highly recommend following designers, animators, and web developers who design and develop projects that you admire. There are some really talented folks on &lt;a href="https://www.behance.net/"&gt;Behance.net&lt;/a&gt;, &lt;a href="https://dribbble.com/"&gt;Dribbble.com&lt;/a&gt;, &lt;a href="https://webflow.com/made-in-webflow"&gt;Webflow.com&lt;/a&gt;, &lt;a href="https://www.awwwards.com/"&gt;awwwards.com/&lt;/a&gt;, etc.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources and More Info:
&lt;/h2&gt;

&lt;p&gt;If you’re just getting started or what to learn more about UX/UI, I would highly recommend checking out the following resources. Thanks for reading. &lt;/p&gt;

&lt;p&gt;Awesome: curated list for Motion UI Design: &lt;a href="https://project-awesome.org/fliptheweb/motion-ui-design"&gt;https://project-awesome.org/fliptheweb/motion-ui-design&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;PageCloud: &lt;a href="https://blog.prototypr.io/how-to-use-animations-and-motion-in-web-design-2fd1f68e6e02"&gt;https://blog.prototypr.io/how-to-use-animations-and-motion-in-web-design-2fd1f68e6e02&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Creating Usability with Motion: &lt;a href="https://medium.com/ux-in-motion/creating-usability-with-motion-the-ux-in-motion-manifesto-a87a4584ddc"&gt;https://medium.com/ux-in-motion/creating-usability-with-motion-the-ux-in-motion-manifesto-a87a4584ddc&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Tools for Animating through CSS:&lt;/p&gt;

&lt;p&gt;Animate.css: &lt;a href="https://animate.style/"&gt;https://animate.style/&lt;/a&gt;tool for making basic animations. Primarily for transitions.&lt;/p&gt;

&lt;p&gt;Bounce.js: &lt;a href="https://github.com/tictail/bounce.js/blob/master/README.md"&gt;https://github.com/tictail/bounce.js/blob/master/README.md&lt;/a&gt;library that lets you create and embed animations into CSS.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>css</category>
    </item>
    <item>
      <title>A Quick Start into Material UI</title>
      <dc:creator>Bernie January Jr.</dc:creator>
      <pubDate>Mon, 20 Jun 2022 03:21:43 +0000</pubDate>
      <link>https://dev.to/janvierjr/a-quick-start-into-material-ui-30ba</link>
      <guid>https://dev.to/janvierjr/a-quick-start-into-material-ui-30ba</guid>
      <description>&lt;p&gt;If you’re curious about &lt;a href="https://v4.mui.com/" rel="noopener noreferrer"&gt;Material UI (MUI)&lt;/a&gt;, aren’t really sure where to start, and are looking for a short jumpstart guide into setting up MUI components using React. This is for you.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Material UI?
&lt;/h2&gt;

&lt;p&gt;A popular UI library that allows developers to reuse well-designed components from &lt;a href="https://material.io/components" rel="noopener noreferrer"&gt;Material Design&lt;/a&gt;, a best-practice design system for front-end development. MUI plays well with React, and provides interactive components for designing responsive user interfaces.&lt;/p&gt;

&lt;h2&gt;
  
  
  MUI Has Excellent Documentation
&lt;/h2&gt;

&lt;p&gt;The Material UI documentation provides a ton of information on multiple components from a simple button to nav menus, to tabs, tables, sliders, etc. You name it, and Material UI has a component that fits your needs. The MUI component API documentation is stocked with great information on each component’s properties, a description of the property with it’s default values, CSS rules, Demos, and code examples. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwf8hbmvpgh261pulkpqh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwf8hbmvpgh261pulkpqh.png" alt="Example of Button Demo and Code from MUI"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Quickly Getting Started in React &amp;amp; Material UI
&lt;/h2&gt;

&lt;p&gt;1- Let's first get set-up in React. If you already have a React project ready and waiting, you can skip down to "Using MUI Components." If not, in your terminal, make a new folder with the git commands: mkdir and whatever you want your app folder to be called. I’m calling mine: material-ui-app&lt;/p&gt;

&lt;p&gt;&lt;code&gt;mkdir material-ui-app&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;2- Open your project in VScode or whatever local development environment you’re using. In your LDE terminal, you can quickly start-up a new project in react with the git command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npx create-react app&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;3- Start the development server with&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm start&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;4- Then bundle the app into static files for production with&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm run build&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;React is an article (multiple articles) for another time. For now, we’re going to use it right out of the box and move on to installing what we need to begin using Material UI components.&lt;/p&gt;

&lt;h2&gt;
  
  
  Using MUI Components
&lt;/h2&gt;

&lt;p&gt;First step, let’s add the Material UI library as a dependency to our React Project, and this will set us up with everything we need to begin importing components. In your LDE terminal type:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm i —save @material-ui/core&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Let's head over to your &lt;strong&gt;App.js&lt;/strong&gt; file and make sure your initial file looks similar to this:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./App.css&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;


&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;App&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;App&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;We're going to start off with the basics. In our &lt;strong&gt;App.js&lt;/strong&gt; file, let's import a Typography component. We'll need to import the component destructured directly from the MUI Library and add the &lt;code&gt;&amp;lt;Typography&amp;gt;&lt;/code&gt; tags directly into our App &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt;. Read more via the &lt;a href="https://v4.mui.com/api/typography/" rel="noopener noreferrer"&gt;Typography API documentation &lt;/a&gt;. As you can probably tell, we're going to be adding a switch component later so I'll type "Here's Our Switch as our text between the &lt;code&gt;&amp;lt;Typography&amp;gt;&lt;/code&gt; component tags.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Typography&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@material-ui/core&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./App.css&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;


&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;App&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

  &lt;span class="p"&gt;};&lt;/span&gt;

  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;App&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; 
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Typography&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nx"&gt;Here&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;s Our Switch
      &amp;lt;/Typography&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}

export default App;


&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Let’s customize our Type:
&lt;/h2&gt;

&lt;p&gt;We’re going to use the built-in MUI properties of align, color, and variant.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;align&lt;/strong&gt;&lt;br&gt;
this prop comes with type values of: ‘left’, ‘center’, ‘right’ and ‘justify’&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;variant&lt;/strong&gt;&lt;br&gt;
this props uses type values of standard html tags: h1 through h6, and body1, caption, etc.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;color&lt;/strong&gt;&lt;br&gt;
this prop has values of ‘inherit’, ‘primary’, secondary’ etc. &lt;br&gt;
The color of each component is supported by MUI themes. Each color prop is automatically adapted by default per component.&lt;/p&gt;

&lt;p&gt;In our example I’ll use: &lt;code&gt;align="center" color="primary" variant="h2"&lt;/code&gt;, but you should feel free to choose values that you like best.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Typography&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@material-ui/core&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./App.css&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;


&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;App&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;App&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; 
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Typography&lt;/span&gt; &lt;span class="nx"&gt;align&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;center&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;color&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;primary&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;variant&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;h2&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nx"&gt;Here&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;s Our Switch
      &amp;lt;/Typography&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}

export default App;


&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;So you might be asking... Where does the color come from? And can I change it? This brings us to the fun part. Themes!&lt;/p&gt;

&lt;h2&gt;
  
  
  MUI Themes
&lt;/h2&gt;

&lt;p&gt;There’s a lot of great documentation on each component’s theme. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Themes are customizable. I’d recommend taking a deep dive into the default theme object. Found here:&lt;/strong&gt; &lt;a href="https://v4.mui.com/customization/default-theme/#default-theme" rel="noopener noreferrer"&gt;https://v4.mui.com/customization/default-theme/#default-theme&lt;/a&gt;, &lt;/p&gt;

&lt;p&gt;This is where all of our default values are coming from and this is how we are going to gain access to each property that we are going to customize. Default Theme is here to help us keep all styles consistent, a UI best-practice.&lt;/p&gt;

&lt;h2&gt;
  
  
  Let’s Create our own Theme:
&lt;/h2&gt;

&lt;p&gt;You'll want to create a new js file called &lt;strong&gt;theme.js&lt;/strong&gt;. You can do a lot with the theme object, but for simplicity we're going to focus on customizing the primary and secondary colors. &lt;/p&gt;

&lt;p&gt;I've added custom HEX codes to the primary and secondary object. Feel free to choose your own colors. If you're not confident about choosing color palettes, &lt;a href="https://coolors.co/" rel="noopener noreferrer"&gt;coolors.co&lt;/a&gt; is a great place to go to help generate ideas / great color combinations.&lt;br&gt;
Below is an example of my &lt;strong&gt;theme.js&lt;/strong&gt; file.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;


&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;createTheme&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@material-ui/core/styles&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;theme&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;createTheme&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;palette&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;primary&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;light&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#b4d6e4&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;main&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#09BC8A&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;dark&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#004346&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;contrastText&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#fff&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="na"&gt;secondary&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;light&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#ff7961&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;main&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#f44336&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;dark&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#ba000d&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;contrastText&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#000&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;theme&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;In our &lt;strong&gt;index.js&lt;/strong&gt; we need to import a &lt;em&gt;ThemeProvider and our theme.js&lt;/em&gt; file like so:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;ReactDOM&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react-dom/client&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./index.css&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./App&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;ThemeProvider&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@material-ui/core&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;theme&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./theme&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;root&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;ReactDOM&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createRoot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;root&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="nx"&gt;root&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;render&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;StrictMode&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;ThemeProvider&lt;/span&gt; &lt;span class="nx"&gt;theme&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;theme&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;App&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
     &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/ThemeProvider&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/React.StrictMode&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Ok, back in the &lt;strong&gt;App.js&lt;/strong&gt; file. Let’s add a switch component just for fun. Again, just head back to the MUI component options. Choose the type of switch you’d like to add to your React app. Use their component code, and voila. As you can see, you’re switch will also inherit the custom theme / color that we created earlier.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;Switch&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@material-ui/core/Switch&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Typography&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@material-ui/core&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./App.css&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;


&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;App&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setState&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;checkedA&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;checkedB&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;handleChange&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;setState&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt; &lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;checked&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="p"&gt;};&lt;/span&gt;

  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;App&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; 
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Typography&lt;/span&gt; &lt;span class="nx"&gt;align&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;center&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;color&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;primary&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;variant&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;h2&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nx"&gt;Here&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;s Our Switch
      &amp;lt;/Typography&amp;gt;
      &amp;lt;Switch
        checked={state.checkedB}
        onChange={handleChange}
        color="primary"
        name="checkedB"
        inputProps={{ &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="nx"&gt;aria&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;label&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;: &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="nx"&gt;primary&lt;/span&gt; &lt;span class="nx"&gt;checkbox&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt; }}
      /&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}

export default App;


&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;And, here's our type and switch.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2bpb260tf1eyutm7tx5p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2bpb260tf1eyutm7tx5p.png" alt="Material UI Typography and Switch"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  In Conclusion
&lt;/h2&gt;

&lt;p&gt;There you have it, your first customized Material UI components. Thanks for reading.&lt;/p&gt;

&lt;p&gt;Here are some Free Resources via MUI’s getting started page.&lt;br&gt;
&lt;strong&gt;Introduction to Material-UI&lt;/strong&gt;: a series of videos covering all the important Material-UI components.&lt;br&gt;
        - 📹 &lt;a href="https://www.youtube.com/watch?v=pHclLuRolzE&amp;amp;list=PLQg6GaokU5CwiVmsZ0d_9Zsg_DnIP_xwr" rel="noopener noreferrer"&gt;The videos&lt;/a&gt;&lt;br&gt;
 &lt;strong&gt;Customize Material-UI for your project&lt;/strong&gt;: a look at how you can customize Material-UI to align with your company identity (design system) and products&lt;br&gt;
        - 📹 &lt;a href="https://www.youtube.com/watch?v=bDkB3LoQKxs" rel="noopener noreferrer"&gt;The videos&lt;/a&gt;&lt;br&gt;
 &lt;strong&gt;Meet Material-UI — your new favorite user interface library&lt;/strong&gt;: a blog post that guides you in building a Todo MVC while covering some important concepts of Material-UI.&lt;br&gt;
        - 📝 &lt;a href="https://medium.freecodecamp.org/meet-your-material-ui-your-new-favorite-user-interface-library-6349a1c88a8c" rel="noopener noreferrer"&gt;The blog post&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Learn React &amp;amp; Material-UI&lt;/strong&gt;: a series of videos covering all the important Material-UI components.&lt;br&gt;
        - 📹 &lt;a href="https://www.youtube.com/watch?v=xm4LX5fJKZ8&amp;amp;list=PLcCp4mjO-z98WAu4sd0eVha1g-NMfzHZk" rel="noopener noreferrer"&gt;The videos&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Getting Started With Material-UI For React&lt;/strong&gt;: a blog post that guides you in building a simple card list.&lt;br&gt;
        - 📝 &lt;a href="https://medium.com/codingthesmartway-com-blog/getting-started-with-material-ui-for-react-material-design-for-react-364b2688b555" rel="noopener noreferrer"&gt;The blog post&lt;/a&gt;&lt;br&gt;
        - 📹 &lt;a href="https://www.youtube.com/watch?v=PWadEeOuv5o" rel="noopener noreferrer"&gt;The video&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Elegant UX in React with Material-UI&lt;/strong&gt;: a blog post covering some important Material-UI concepts.&lt;br&gt;
        - 📝 &lt;a href="https://alligator.io/react/material-ui/" rel="noopener noreferrer"&gt;The blog post&lt;/a&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>tutorial</category>
      <category>react</category>
      <category>materialui</category>
    </item>
    <item>
      <title>An Intro to UX/UI</title>
      <dc:creator>Bernie January Jr.</dc:creator>
      <pubDate>Mon, 13 Jun 2022 05:20:56 +0000</pubDate>
      <link>https://dev.to/janvierjr/an-intro-to-uxui-2bi8</link>
      <guid>https://dev.to/janvierjr/an-intro-to-uxui-2bi8</guid>
      <description>&lt;p&gt;Let's begin with the obvious... &lt;br&gt;
&lt;em&gt;Also, be sure to read to the bottom of the page as I provide some additional resources if you're hungry for more.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  So, what is UX/UI?
&lt;/h2&gt;

&lt;p&gt;UX/UI is a new term for a design concept that has been around for quite some time, but let’s break the terminology down into its component parts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;UX stands for User Experience.&lt;/strong&gt; UX is how an end-user i.e. the specific audience you’re developing for: a customer, website visitor, app user, etc. experiences your product from the first touch to last. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;UI stands for User Interface.&lt;/strong&gt; A user interface refers the presentation of your product to your end-user i.e the look and feel of your product, the components of a website or app, and the interactivity of those components.&lt;/p&gt;

&lt;p&gt;These design concepts can be applied to the creation of any product like... a car for example: the UX for the driver will depend on the car’s performance, safety features, the drive experience, etc. The car UI for the driver includes: the car’s exterior and interior styling, the dashboard, entertainment console, the steering wheel, how the car presents to the user, etc.  &lt;/p&gt;

&lt;p&gt;We’ll focus our attention on digital products moving forward, but these design concepts have broad application across many product types.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ITtu95hj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jp8wblhi7cctm57cir1j.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ITtu95hj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jp8wblhi7cctm57cir1j.jpeg" alt="Image credit: CareerFoundry.com" width="800" height="820"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Human-centered Design:
&lt;/h2&gt;

&lt;p&gt;You’ve probably heard of the term Human-centered or user-centered design within the context of UX/UI, and if you haven’t, we want our products to be user-centered (i.e puts the user front and center) because well, we’re making them for people, and our end-user should be at the center of every design decision. &lt;/p&gt;

&lt;p&gt;What does it mean for a product to be Human-centered, I’m so glad you asked. It means our products should specifically be &lt;em&gt;Usable&lt;/em&gt;, &lt;em&gt;Equitable&lt;/em&gt;, &lt;em&gt;Enjoyable&lt;/em&gt;, &lt;em&gt;Useful&lt;/em&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  UX | How Users experience your product
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Usable&lt;/strong&gt; - &lt;em&gt;Is it functional?&lt;/em&gt; The design and function is clear for everyone to understand. Self-guiding questions one can ask to determine if a product is usable: Can users accomplish specific tasks within the design? Is the functionality of the product easy to understand? &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Equitable&lt;/strong&gt; - &lt;em&gt;Are the needs of a diverse group of users considered?&lt;/em&gt; Our products should be inclusive of end-users of diverse abilities and backgrounds. Questions to ask to determine if a product is equitable: Does the product address the needs underrepresented groups? Does the product only work for abled users?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Enjoyable&lt;/strong&gt; - &lt;em&gt;Does it keep the user engaged?&lt;/em&gt; Our goal is to create a positive connection between our users and our product. Questions to ask to determine if a product is enjoyable: Does the product and it’s design inspire delight in the user? Are there aspects of the design that consider the user’s feelings?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Useful&lt;/strong&gt; - &lt;em&gt;Does it solve a problem?&lt;/em&gt; We should make products that add value to people’s lives. Questions to determine if a product is useful: Does the product design solve a problem for the user? Does the design / product help your users achieve a specific goal?&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  UI | How your product looks &amp;amp; responds to User actions
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Creating a Design System&lt;/strong&gt;: the user interface is the juncture where the user and the product meet through the medium of a digital device like a mobile phone, computer, or tablet. Check out this color system / global color guide from &lt;a href="https://material.io/design/color/the-color-system.html#color-theme-creation"&gt;Material Design&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;It’s important to keep your product design consistent, coherent, and accessible…. i.e choosing colors with high enough contrast for users to read type while avoiding color combinations that strain a user's vision.&lt;/p&gt;

&lt;p&gt;A product’s UI is created with a visual collection of design elements that include typography, color schema, icons &amp;amp; buttons, animations, imagery, and responsive layouts that adapt to device type. Again, I cannot stress enough the importance of consistency regarding these elements because a good design system reinforces user confidence, coherence, and product usability.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Product Development Lifecycle
&lt;/h2&gt;

&lt;p&gt;Everyone wants to dive in and create prototypes, but developing a great product requires quite a few steps before jumping into prototyping. Because a product's UX and UI are informed by one another and most importantly, the end user. Product development is a cycle of research, iteration, and testing. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dsszrJ8S--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pbro26bdv2o4fi68cp9m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dsszrJ8S--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pbro26bdv2o4fi68cp9m.png" alt="Product development lifecycle" width="800" height="519"&gt;&lt;/a&gt; &lt;em&gt;image credit: Google UX&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Brainstorm&lt;/strong&gt;&lt;br&gt;
Initial process for coming up with ideas for/about product.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Define&lt;/strong&gt;&lt;br&gt;
Defining the product. Who is the end user for this product? What will the product do? What features are needed to be successful? Pin down the focus of the product.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Design&lt;/strong&gt;&lt;br&gt;
Draw wireframes, create low-fidelity prototypes &amp;amp; high-fidelity, and create early models/user-flows of the product’s functionality. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Test&lt;/strong&gt;&lt;br&gt;
Test the product with users to consider the interactivity of product design and decide what might need to change based on user feedback.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Launch&lt;/strong&gt;&lt;br&gt;
Sharing a finished version of product with the public&lt;br&gt;
Real-world understanding&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Back to Prototyping &amp;amp; Using Prototypes in Development
&lt;/h2&gt;

&lt;p&gt;I know what you’re here for. Adobe XD and Figma are the most common and widely used design tools for building UI Prototypes. There are some great tutorial resources out there, but &lt;a href="https://www.adobe.com/products/xd/learn/get-started.html"&gt;Adobe XD's Start Page&lt;/a&gt; and &lt;a href="https://www.figma.com/resources/learn-design/"&gt;Figma's Learn Design Page&lt;/a&gt; are great places to start. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use the built-in developer tools: in Adobe XD:&lt;/strong&gt;&lt;br&gt;
Use the share tab to export a development friendly link that includes CSS.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--JFpKl86d--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l6tz2bstzg1fr2840tij.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JFpKl86d--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l6tz2bstzg1fr2840tij.png" alt="Click the share tab and export image" width="800" height="595"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--i6xvCjtV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8vgo6wv0jx2qfc69tdwy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--i6xvCjtV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8vgo6wv0jx2qfc69tdwy.png" alt="The developer link includes CSS" width="800" height="588"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use built-in developer tools: in Figma:&lt;/strong&gt;&lt;br&gt;
Use the inspect tab and the ALT or OPTION key to inspect your UI prototype that includes CSS&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--j3SqdO70--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/03wes98e0zkwh50js1fz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--j3SqdO70--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/03wes98e0zkwh50js1fz.png" alt="Figma inspect view" width="800" height="590"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Inspect the CSS&lt;/strong&gt;&lt;br&gt;
Be sure to test the CSS taken from any prototype. You should be especially careful of the prototype's CSS position. In most cases, your UI prototype will default to absolute, which won't give you the responsive elements that you likely desire.&lt;/p&gt;

&lt;h2&gt;
  
  
  For More Info
&lt;/h2&gt;

&lt;p&gt;If you’re just getting started or want to learn more about UX/UI, I would highly recommend checking out the following resources. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;Resources Links:&lt;/em&gt; &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://uxdesign.cc/"&gt;UX Collective&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.adobe.com/products/xd/learn/get-started.html"&gt;Adobe XD&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.figma.com/resources/learn-design/"&gt;Figma&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.coursera.org/professional-certificates/google-ux-design?utm_source=gg&amp;amp;utm_medium=sem&amp;amp;utm_campaign=15-GoogleUXDesign-US&amp;amp;utm_content=B2C&amp;amp;campaignid=12512630840&amp;amp;adgroupid=118346521679&amp;amp;device=c&amp;amp;keyword=ux%20experience%20design&amp;amp;matchtype=b&amp;amp;network=g&amp;amp;devicemodel=&amp;amp;adpostion=&amp;amp;creativeid=504987650365&amp;amp;hide_mobile_promo&amp;amp;gclid=CjwKCAjwnZaVBhA6EiwAVVyv9JIUlGApZVYGQUPkE1Iwuu90VJpwhg4o4cHHfhnvv0Sn-t0_vMzPhxoCAjUQAvD_BwE"&gt;Google UX Design Certification&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://material.io/design"&gt;Material Design&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://digital.gov/resources/"&gt;Digital.gov Resources&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Thanks for reading. If you found this content useful, every like and share is appreciated.&lt;/p&gt;

&lt;p&gt;** cover image designed by: &lt;a href="http://www.freepik.com"&gt;Freepik&lt;/a&gt; ** &lt;/p&gt;

</description>
      <category>beginners</category>
      <category>uiweekly</category>
      <category>ux</category>
      <category>css</category>
    </item>
    <item>
      <title>Your Icons should probably be SVG files. Here’s why.</title>
      <dc:creator>Bernie January Jr.</dc:creator>
      <pubDate>Sun, 24 Apr 2022 22:43:46 +0000</pubDate>
      <link>https://dev.to/janvierjr/your-icons-should-probably-be-svg-files-heres-why-4pad</link>
      <guid>https://dev.to/janvierjr/your-icons-should-probably-be-svg-files-heres-why-4pad</guid>
      <description>&lt;p&gt;After reading this, you may never use a .PNG file for an icon again.&lt;br&gt;
First things first. &lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;What is an .SVG file?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;An SVG (Scaleable Vector Graphic) is a popular, web-friendly file format.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The advantages SVG files have over PNGs or JPGs:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Unlike raster files (i.e. JPGs and PNGs), which are made up of pixels, vector graphics like &lt;u&gt;SVGs always maintain their resolution &lt;/u&gt; no matter how large or small you make them. No more blurry icons! You need not worry about SVGs losing their visual quality in certain browsers or when you resize them to appear in different places.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Basic SVG files often have smaller file sizes&lt;/u&gt; than PNGs or JPGs, which are built from tons of pixels as opposed to mathematical algorithms. &lt;/p&gt;

&lt;p&gt;Because SVG files treat text as text, screen readers can scan any words contained in SVG images. Therefore, &lt;u&gt;your website is more accessible and useful for people who need help reading webpages.&lt;/u&gt; Search engines can also read and index SVG image text.&lt;/p&gt;

&lt;p&gt;If you’re interested in learning more, here's an SVG deep dive from Adobe: &lt;a href="https://www.adobe.com/creativecloud/file-types/image/vector/svg-file.html" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Now for the fun part… adding SVGs to your project.&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;How to Add SVGs to your website:&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;You can insert SVGs directly into your HTML file and easily adjust them with CSS.&lt;/p&gt;

&lt;p&gt;Let’s break it down step-by-step:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;STEP 1: Create an SVG file or Find an SVG file:&lt;/strong&gt;&lt;br&gt;
When creating an SVG, it’s best-practice to use a vector graphics editor like Adobe Illustrator. Not a designer; not to worry. You can find free SVGs and/or purchase SVGs on sites like: &lt;a href="https://thenounproject.com/" rel="noopener noreferrer"&gt;The Noun Project&lt;/a&gt; or &lt;a href="https://icons8.com/" rel="noopener noreferrer"&gt;Icons8&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;I’m saving this example SVG via Adobe Illustrator.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F30ha1kze0prh3q48cikx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F30ha1kze0prh3q48cikx.png" alt="save as svg file screenshot"&gt;&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;&lt;strong&gt;Step 2: Get the SVG code:&lt;/strong&gt;&lt;br&gt;
The easiest way to get your SVG file’s code is simply to right-click the file and open it in a simple text editor like TextEdit. I’m also going to change the attribute id to “icon” inside of my svg tags, but feel free to give your id any name you like. Like so:  &lt;code&gt;&amp;lt;svg id=”icon”… &amp;gt;&amp;lt;/svg&amp;gt;&lt;/code&gt; Now, select all of the text starting from the SVG open tag through to the close tag  &lt;code&gt;&amp;lt;svg id=”icon”…. &amp;gt;&amp;lt;/svg&amp;gt;&lt;/code&gt; and copy it (CMD + C on a Mac or CTRL + C on Windows).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmv5x7bws6mt2bvuc96pp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmv5x7bws6mt2bvuc96pp.png" alt="open svg file screenshot"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq36qjmotyd80c9hl7td1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq36qjmotyd80c9hl7td1.png" alt="change to id="&gt;&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;&lt;strong&gt;Step 3: Adding your SVG code into your project:&lt;/strong&gt;&lt;br&gt;
There are a few ways to do this. So, feel free to go off-script here if you have a preferred method for adding elements to the body of your html file. Especially if you’re looking to place your SVG inside a specific &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;But for simplicity's sake, I’m going to paste (CMD + V on a Mac or CTRL + V on Windows) my SVG code directly inside the body tag of my html file: &lt;code&gt;&amp;lt;body&amp;gt; (paste here) &amp;lt;/body&amp;gt;&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;body id="body"&amp;gt;
  &amp;lt;svg id="icon" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"&amp;gt;
    &amp;lt;path

d="M12,.92A11.08,11.08,0,1,0,23.08,12,11.08,11.08,0,0,0,12,.92Zm5.52,15.191.41,1.41L12,13.41,7.89,17.52,6.48,16.11,10.59,12,6.48,7.89,7.89,6.48,12,10.59l4.11-4.11,1.41,1.41L13.41,12Z" /&amp;gt;
  &amp;lt;/svg&amp;gt;
&amp;lt;/body&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;This is what you should see when you preview your html file.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsjsg9qbzos1rdbpusnk8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsjsg9qbzos1rdbpusnk8.png" alt="index.html file with pasted SVG code in body tag"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Step 4: Styling your SVG code:&lt;/strong&gt;&lt;br&gt;
You can style your SVG any way you’d like. Choose the colors, size, attributes, etc. that fit your fancy. I’m going to change the size of my SVG to 5em. (Yes, I know that's too big. Ignore that... it's for screenshot visibility.) &lt;/p&gt;

&lt;p&gt;In your CSS file, type: '#icon', which references id="icon" in your SVG code in your html file, and within the curly brackets, type: 'width: 5em;' or whatever size width you'd like your icon to be.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#icon {
  width: 5em;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;This is what you should see when you preview your html file.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnla2ff088t92xb8micmo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnla2ff088t92xb8micmo.png" alt="index.html file with CSS width added"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I'm going to change the fill color of my SVG to blue in my project’s CSS file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#icon {
  width: 5em;
  fill: blue;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;Again, this is what you should see when you preview your html file.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9bqechjskrf6m47yj9av.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9bqechjskrf6m47yj9av.png" alt="index.html file with CSS fill added"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And there you have it. Easy-peasy lemon squeezy. &lt;/p&gt;

&lt;p&gt;It’s also pretty simple to add hover effects or animations to your SVG file with CSS. Design, experiment and iterate away. &lt;/p&gt;

&lt;p&gt;If you liked this article, give it a like, share, or comment.&lt;br&gt;
&lt;strong&gt;Thanks for reading&lt;/strong&gt;. &lt;/p&gt;

</description>
      <category>css</category>
      <category>html</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
