<?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: GibboK</title>
    <description>The latest articles on DEV Community by GibboK (@gibbok).</description>
    <link>https://dev.to/gibbok</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%2F179230%2F45f284c4-9de6-40a7-9211-ae33da59e826.png</url>
      <title>DEV Community: GibboK</title>
      <link>https://dev.to/gibbok</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/gibbok"/>
    <language>en</language>
    <item>
      <title>Get started with Industrial UI</title>
      <dc:creator>GibboK</dc:creator>
      <pubDate>Fri, 10 Jul 2020 07:32:50 +0000</pubDate>
      <link>https://dev.to/gibbok/get-started-with-industrial-ui-4dcf</link>
      <guid>https://dev.to/gibbok/get-started-with-industrial-ui-4dcf</guid>
      <description>&lt;p&gt;Industrial UI is a React toolkit built by &lt;a href="https://www.actyx.com"&gt;Actyx&lt;/a&gt;, a German tech company specializing in &lt;a href="https://www.actyx.com/products/os/"&gt;distributed edge computing for factories&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The toolkit features over 45 components such as buttons, tabs, cards, navigation all of which have designed and tested to maximize operators' user experience and productivity in industrial environments.&lt;/p&gt;

&lt;p&gt;GitHub project can be found here:&lt;br&gt;
&lt;a href="https://github.com/Actyx/industrial-ui"&gt;https://github.com/Actyx/industrial-ui&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  📦 How to set up a new project and import Industrial UI
&lt;/h2&gt;

&lt;p&gt;In this mini-tutorial, you will learn how to set up a React project based on TypeScript and how to include Industrial UI.&lt;/p&gt;

&lt;p&gt;You need to have &lt;a href="https://nodejs.org/en/download/"&gt;Node.js®&lt;/a&gt; installed on your machine.&lt;/p&gt;

&lt;p&gt;First of all make sure you install &lt;a href="https://github.com/facebook/create-react-app#readme"&gt;Create React App&lt;/a&gt;, which is an officially supported way to create single-page React applications.&lt;/p&gt;

&lt;p&gt;We suggest it as it offers a modern build setup with no configuration, but you can otherwise use Industrial UI on any React TypeScript projects.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;npm i &lt;span class="nt"&gt;-g&lt;/span&gt; create-react-app
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;In your folder of choice set up a new React project based on TypeScript:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;npx create-react-app my-app &lt;span class="nt"&gt;--template&lt;/span&gt; typescript
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Open the folder project and edit &lt;code&gt;src/App.tsx&lt;/code&gt; such:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from 'react';
import './App.css';
import { Typography, Button } from '@actyx/industrial-ui'

function App() {
  const [text, setText] = React.useState('')

  return (
    &amp;lt;div&amp;gt;
      &amp;lt;Button
        variant="raised"
        color="primary"
        icon="announcement"
        text="Say hello world!"
        onClick={() =&amp;gt; setText('Hello, World! 😎')}
      /&amp;gt;
      &amp;lt;div&amp;gt;
        &amp;lt;Typography variant="giant"&amp;gt;{text}&amp;lt;/Typography&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  )
}

export default App;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Now run your project by using &lt;code&gt;npm start&lt;/code&gt;, your hello world page is visible at &lt;a href="http://localhost:3000/"&gt;http://localhost:3000/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  📖 Details
&lt;/h2&gt;

&lt;p&gt;At the top of the file we have imported Industrial UI components by using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight typescript"&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;Typography&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Button&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;@actyx/industrial-ui&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;In the &lt;code&gt;App&lt;/code&gt; component, we use React hook, which lets you use state without writing a class.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight typescript"&gt;&lt;code&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setText&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="nx"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&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;Variable &lt;code&gt;text&lt;/code&gt; will contain a string with our message, and function &lt;code&gt;setText()&lt;/code&gt; will be used to change the value of &lt;code&gt;text&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Add a Button component from Industrial UI, you can choose between different colors and styles, please reference our &lt;a href="https://actyx.github.io/industrial-ui/index.html?path=/docs/components-button--flat-transparent-text"&gt;documentation&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight typescript"&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;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;raised&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;icon&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;announcement&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
        &lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Say hello world!&lt;/span&gt;&lt;span class="dl"&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="nx"&gt;setText&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hello, World! 😎&lt;/span&gt;&lt;span class="dl"&gt;'&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;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;onClick&lt;/code&gt; property accept a function callback, which will set variable &lt;code&gt;text&lt;/code&gt; via &lt;code&gt;setText()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Simply show the content of our variable &lt;code&gt;text&lt;/code&gt; in a nice typography element.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight typescript"&gt;&lt;code&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;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;giant&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="nx"&gt;text&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;/Typography&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;And that is! You just learn how to include Industrial UI in a new project. 👏&lt;/p&gt;

&lt;p&gt;For more information about Industrial UI API please refer to the &lt;a href="https://actyx.github.io/industrial-ui/?path=/docs/components-batteryicon--charged-100"&gt;documentation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you want to learn a modern way of digitizing factory processes, build and run apps on a secure, performant decentralized edge platform with no servers, no brokers, no datacenter, please visit &lt;a href="https://www.actyx.com/"&gt;Actyx website&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Happy coding! 👨‍💻&lt;/p&gt;

</description>
      <category>react</category>
      <category>typescript</category>
      <category>uiweekly</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
