[[configure-comboboxes-wisely]] Configure ComboBoxes wisely --------------------------- The Vaadin *ComboBox* is a versatile input field with lots of settings that change its behavior. The default settings are a good start, but are not necessarily suitable for all situations. Configure your ComboBoxes properly to avoid usability issues and make use of their advanced features. image:img/combo2.png[ComboBox] [[null-selection]] Null selection ^^^^^^^^^^^^^^ By default, the *ComboBox* component has null selection enabled, which means that the drop down list contains an *empty element* that maps to `null`. If you don’t want users to be able to select _“none”_, you should disable null selection with `setNullSelectionAllowed(false)`. If you _do_ want to allow null selection, you might want to set a specific caption for the empty item by adding a “dummy” option to the list and setting it as the null selection item: [source,java] .... ComboBox cbExample = new ComboBox(); cbExample.setNullSelectionAllowed(true); cbExample.addItem(“[ None ]”); cbExample.setNullSelectionItemId(“[ None ]”); .... Consider surrounding the null item’s caption with brackets or dashes to distinguish it from the other options, and make sure that it ends up in the beginning or end of the list. [[enable-text-input-only-when-appropriate]] Enable text input only when appropriate ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The Vaadin ComboBox can behave either as an actual combo box (i.e. combining a textfield with a dropdown list), but also as a normal dropdown menu, like the html `` element. But then you can’t have an input prompt or any of the other nice features of *ComboBox*.)