The path type provides a textbox that captures and validates a path within the system. You can set the #convert_path attribute to either PathElement::CONVERT_NONE to return the string value that was entered, PathElement::CONVERT_ROUTE to return an array containing the route name and parameters, or PathElement::CONVERT_URL to return a URL object in the FormState. You can also disable the path validation by setting the #validate_path attribute to FALSE. The path type inherits from the textfield type and can use any attributes that apply to it as well. Take this example into consideration:
$form['path'] = array(
'#type' => 'path',
'#title' => $this->t('Path'),
);

Path type