title: Add custom attribute in magento 2
body: <p>How to add a custom field to the frontend registration form.
  I already added required feilds in database by following </p>
  
  <pre><code>public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
  {
      $eavSetup = $this-&gt;eavSetupFactory-&gt;create(['setup' =&gt; $setup]);
      $eavSetup-&gt;addAttribute(
          \Magento\Customer\Model\Customer::ENTITY,
          'sample_attribute',
          [
              'type'         =&gt; 'varchar',
              'label'        =&gt; 'Sample Attribute',
              'input'        =&gt; 'text',
              'required'     =&gt; false,
              'visible'      =&gt; true,
              'user_defined' =&gt; true,
              'position'     =&gt; 999,
              'system'       =&gt; 0,
          ]
      );
      $sampleAttribute = $this-&gt;eavConfig-&gt;getAttribute(Customer::ENTITY, 'sample_attribute');
  
      // more used_in_forms ['adminhtml_checkout','adminhtml_customer','adminhtml_customer_address','customer_account_edit','customer_address_edit','customer_register_address']
      $sampleAttribute-&gt;setData(
          'used_in_forms',
          ['adminhtml_customer']
  
      );
      $sampleAttribute-&gt;save();
  }
  </code></pre>
  
  <p>my feild listed in magento admin. I'm unable to display it in frontend</p>