diff --git a/block_class.install b/block_class.install
index fbe0e40..e7c825c 100644
--- a/block_class.install
+++ b/block_class.install
@@ -30,6 +30,9 @@ function block_class_uninstall() {
   foreach ($schema['block']['fields'] as $field => $specs) {
     db_drop_field('block', $field);
   }
+  variable_del('block_class_widget');
+  variable_del('block_class_source');
+  variable_del('block_class_predefined_values');
 }
 
 /**
diff --git a/block_class.js b/block_class.js
new file mode 100644
index 0000000..60e23bb
--- /dev/null
+++ b/block_class.js
@@ -0,0 +1,21 @@
+/**
+ * @file
+ * Small javascript to change UI settings on Block Class' admin form.
+ */
+(function ($) {
+  Drupal.behaviors.blockClass = {
+    attach: function (context, settings) {
+      if ($('#edit-block-class-source', context).attr('value') !== 'predefined') {
+        $('.form-item-block-class-predefined-values', context).hide();
+      }
+      $('#edit-block-class-source', context).change(function () {
+        if ($(this).attr('value') !== 'predefined') {
+          $('.form-item-block-class-predefined-values', context).hide();
+        }
+        else {
+          $('.form-item-block-class-predefined-values', context).show();
+        }
+      });
+    }
+  };
+})(jQuery);
diff --git a/block_class.module b/block_class.module
index 22b2022..4189e05 100644
--- a/block_class.module
+++ b/block_class.module
@@ -11,6 +11,57 @@
  */
 
 /**
+ * Implements hook_menu() for the settings form and the autocomplete callback.
+ */
+function block_class_menu() {
+  $items['admin/config/content/blockclass'] = array(
+    'title' => 'Block Class',
+    'description' => 'Configure dropdown/predefined values for CSS classes.',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('block_class_admin_form'),
+    'access arguments' => array('administer block classes settings'),
+    'type' => MENU_NORMAL_ITEM,
+  );
+  $items['blockclass/autocomplete'] = array(
+    'title' => 'Block Class Autocomplete',
+    'page callback' => '_block_class_get_values_autocomplete',
+    'access arguments' => array('administer block classes'),
+    'type' => MENU_CALLBACK,
+  );
+  return $items;
+}
+
+/**
+ * Creates the settings form.
+ */
+function block_class_admin_form() {
+  $form = array();
+  $form['block_class_widget'] = array(
+    '#type' => 'select',
+    '#title' => t('Widget'),
+    '#default_value' => variable_get('block_class_widget', 'textfield'),
+    '#options' => array('textfield' => t('Textfield'), 'dropdown' => t('Dropdown'), 'autocomplete' => t('Autocomplete')),
+    '#description' => t("By default the widget is textfield. Use dropdown when you only use one value. Use autocomplete when you want autocomplete on multiple values."),
+  );
+  $form['block_class_source'] = array(
+    '#type' => 'select',
+    '#title' => t('Source of the dropdown/autocomplete'),
+    '#default_value' => variable_get('block_class_source', 'database'),
+    '#options' => array('database' => t('Database'), 'predefined' => t('Predefined set of values')),
+    '#description' => t("By choosing database, it'll search every distinct set of values. Predefined set of values allows the administrator to arbitrary define the classes available."),
+  );
+  $form['block_class_predefined_values'] = array(
+    '#type' => 'textarea',
+    '#title' => t('Predefined values'),
+    '#default_value' => variable_get('block_class_predefined_values', ''),
+    '#description' => t("Enter a list of classes separated by a space, comma, or line-break."),
+  );
+  $form['#attached']['js'][] = drupal_get_path('module', 'block_class') . '/block_class.js';
+  return system_settings_form($form);
+}
+
+
+/**
  * Implements hook_permission().
  */
 function block_class_permission() {
@@ -19,6 +70,10 @@ function block_class_permission() {
       'title' => t('Administer block classes'),
       'description' => t('Set CSS classes for blocks.'),
     ),
+    'administer block classes settings' => array(
+      'title' => t('Administer Block Class settings'),
+      'description' => t('Configure settings for CSS classes.'),
+    )
   );
 }
 
@@ -64,15 +119,30 @@ function block_class_form_alter(&$form, &$form_state, $form_id) {
   if (user_access('administer block classes') && ($form_id == 'block_admin_configure' || $form_id == 'block_add_block_form')) {
     // Load statically cached block object used to display the form.
     $block = block_load($form['module']['#value'], $form['delta']['#value']);
+    $default_value = isset($block->css_class) ? $block->css_class : '';
 
     $form['settings']['css_class'] = array(
       '#type' => 'textfield',
       '#title' => t('CSS class(es)'),
-      '#default_value' => isset($block->css_class) ? $block->css_class : '',
-      '#description' => t('Customize the styling of this block by adding CSS classes. Separate multiple classes by spaces.'),
+      '#default_value' => $default_value,
       '#maxlength' => 255,
     );
 
+        // Check the widget defined in the settings
+    $widget = variable_get('block_class_widget', 'textfield');
+    if ($widget == 'textfield') {
+      $form['settings']['css_class']['#type'] = 'textfield';
+      $form['settings']['css_class']['#description'] = t('Customize the styling of this block by adding CSS classes. Separate multiple classes by spaces.');
+    }
+    elseif ($widget == 'dropdown') {
+      $form['settings']['css_class']['#type'] = 'select';
+      $form['settings']['css_class']['#options'] = _block_class_get_values_dropdown($default_value);
+    }
+    elseif ($widget == 'autocomplete') {
+      $form['settings']['css_class']['#type'] = 'textfield';
+      $form['settings']['css_class']['#autocomplete_path'] = 'blockclass/autocomplete';
+    }
+
     $form['#submit'][] = 'block_class_form_submit';
   }
 }
@@ -98,3 +168,86 @@ function block_class_form_submit($form, &$form_state) {
     }
   }
 }
+
+/**
+ * Function to get all the values from the database/predefined and return them
+ * combined with the default value.
+ */
+function _block_class_get_values_dropdown($default) {
+  $result = array();
+  $result_keys = array();
+
+  // Check the source type.
+  $source = variable_get('block_class_source', 'database');
+  if ($source == 'database') {
+    $result = db_select('block', 'b')
+    ->fields('b', array('css_class'))
+    ->condition('css_class', '', '!=')
+    ->distinct()
+    ->execute()
+    ->fetchCol();
+  }
+  elseif ($source == 'predefined') {
+    // Gets the list of predefined values
+    $predefined = variable_get('block_class_predefined_values', '');
+    if (!empty($predefined)) {
+      $result = preg_split( "/[\s,]+/", $predefined);
+    }
+  }
+  if (!empty($default) && !in_array($default, $result)) {
+    array_unshift($result, $default);
+  }
+
+  // Let's define a way to not specify any class.
+  $result_keys = $result;
+  array_unshift($result_keys, '');
+  array_unshift($result, t('- No Class -'));
+  return array_combine($result_keys, $result);
+}
+
+/**
+ * Function to get the values from the database/predefined filtered by a keyword
+ */
+function _block_class_get_values_autocomplete($keywords) {
+  $result = array();
+  $matches = array();
+  $keywords_exploded = preg_split( "/[\s,]+/", $keywords);
+  $last_keyword = trim(array_pop($keywords_exploded));
+
+  // Check the source type.
+  $source = variable_get('block_class_source', 'database');
+  if ($source == 'database') {
+    $result = db_select('block', 'b')
+    ->fields('b', array('css_class'))
+    ->condition('css_class', '%' . $last_keyword . '%', 'LIKE')
+    ->condition('css_class', '', '!=')
+    ->distinct()
+    ->range(0, 20)
+    ->execute()
+    ->fetchCol();
+  }
+  elseif ($source == 'predefined') {
+    // Gets the list of predefined values
+    $predefined = variable_get('block_class_predefined_values', '');
+    if (!empty($predefined)) {
+      $data = preg_split( "/[\s,]+/", $predefined);
+      $result = array_filter($data, function ($item) use ($last_keyword) {
+        if (stripos($item, $last_keyword) !== FALSE) {
+          return TRUE;
+        }
+        return FALSE;
+      });
+      $result = array_slice($result, 0, 20);
+    }
+  }
+
+  // Prefix the results with previous data to allow autocomplete to run for
+  // every word
+  $prefix = count($keywords_exploded) ? implode(' ', $keywords_exploded) . ' ' : '';
+  foreach ($result as $class) {
+    $matches[$prefix . $class] = check_plain($class);
+  }
+
+  return drupal_json_output($matches);
+}
+
