diff --git a/src/Element/YamlFormEntitySelect.php b/src/Element/YamlFormEntitySelect.php
index 55ebda5..11978ba 100755
--- a/src/Element/YamlFormEntitySelect.php
+++ b/src/Element/YamlFormEntitySelect.php
@@ -19,7 +19,7 @@ class YamlFormEntitySelect extends Select {
    */
   public static function processSelect(&$element, FormStateInterface $form_state, &$complete_form) {
     if (!isset($element['#options'])) {
-      $element['#options'] = self::getOptions($element['#target_type'], $element['#selection_handler'], $element['#selection_settings']);
+      $element['#options'] = self::getOptions($element['#target_type'], $element['#selection_handler'], $element['#selection_settings'], FALSE);
     }
     $element = parent::processSelect($element, $form_state, $complete_form);
     return $element;
diff --git a/src/Element/YamlFormEntityTrait.php b/src/Element/YamlFormEntityTrait.php
index fe9140f..32499fb 100755
--- a/src/Element/YamlFormEntityTrait.php
+++ b/src/Element/YamlFormEntityTrait.php
@@ -29,6 +29,8 @@ trait YamlFormEntityTrait {
    *   The plugin ID of the entity reference selection handler.
    * @param array $selection_settings
    *   An array of settings that will be passed to the selection handler.
+   * @param bool $flatten_options
+   *   Flatten options. Default value is TRUE.
    *
    * @return array
    *   An associative array of entity key and labels as options.
@@ -39,8 +41,8 @@ trait YamlFormEntityTrait {
    *
    * @see \Drupal\system\Controller\EntityAutocompleteController
    */
-  public static function getOptions($target_type, $selection_handler, $selection_settings) {
-    $options = [
+  public static function getOptions($target_type, $selection_handler, $selection_settings, $flatten_options = TRUE) {
+    $selection_handler_options = [
       'target_type' => $target_type,
       'handler' => $selection_handler,
       'handler_settings' => $selection_settings,
@@ -48,8 +50,17 @@ trait YamlFormEntityTrait {
 
     /** @var \Drupal\Core\Entity\EntityReferenceSelection\SelectionPluginManagerInterface $selection_manager */
     $selection_manager = \Drupal::service('plugin.manager.entity_reference_selection');
-    $handler = $selection_manager->getInstance($options);
-    return OptGroup::flattenOptions($handler->getReferenceableEntities());
+    $handler = $selection_manager->getInstance($selection_handler_options);
+    $options = $handler->getReferenceableEntities();
+    if ($flatten_options) {
+      return OptGroup::flattenOptions($options);
+    }
+    elseif (count($options) == 1 && isset($options[$target_type])) {
+      return reset($options);
+    }
+    else {
+      return $options;
+    }
   }
 
 }
diff --git a/src/Plugin/YamlFormElement/YamlFormEntityOptionsTrait.php b/src/Plugin/YamlFormElement/YamlFormEntityOptionsTrait.php
index 03eb298..cd863af 100644
--- a/src/Plugin/YamlFormElement/YamlFormEntityOptionsTrait.php
+++ b/src/Plugin/YamlFormElement/YamlFormEntityOptionsTrait.php
@@ -28,7 +28,8 @@ trait YamlFormEntityOptionsTrait {
    */
   public function prepare(array &$element, YamlFormSubmissionInterface $yamlform_submission) {
     if (!isset($element['#options'])) {
-      $element['#options'] = YamlFormEntityTrait::getOptions($element['#target_type'], $element['#selection_handler'], $element['#selection_settings']);
+      $flatten_options = ($this instanceof YamlFormEntitySelect) ? FALSE : TRUE;
+      $element['#options'] = YamlFormEntityTrait::getOptions($element['#target_type'], $element['#selection_handler'], $element['#selection_settings'], $flatten_options);
     }
     parent::prepare($element, $yamlform_submission);
   }
