How to Add Custom Field in Magento 2 Registration Form
Adding Customer EAV Attribute
Add custom fields or attribute on Magento 2 Registration form. This attribute also will show in add or edit customer form in Magento 2 Admin.
Creating Module
Create Rsgitech_Customer module.
module.xml
Create file module.xml app/code/Rsgitech/Customer/etc/module.xml
registration.php
Create file registration.php app/code/Rsgitech/Customer/registration.php for register the module.
InstallData.php
Customer attributes are created inside of InstallData and UpgradeData scripts. To add new attributes to the database, you must use the \Magento\Eav\Setup\EavSetupFactory class as a dependency injection.
Create file InstallData.php app/code/Rsgitech/Customer/Setup/InstallData.php for creating customer attribute.
additional.phtml
Create view file additional.phtml app/code/Rsgitech/Customer/view/frontend/templates/additional.phtml for show field on customer registration form.
customer_account_create.xml
Create layout file customer_account_create.xml app/code/Rsgitech/Customer/view/frontend/layout/customer_account_create.xml
Run this command