A dropdown can be used to select between choices in a form
Converting Select Elements
You can initialize a selection dropdown directly on a select element, any option that is given a blank value will automatically be converted into a placeholder
Keep in mind however, if you initialize a dropdown directly on a select element, the dropdown contents will be hidden until javascript can render the element, causing a flash of unstyled content.
Gender
Male
Female
Search Selection
A selection dropdown can allow a user to search through a large list of choices.
Select Country
Andorra
United Arab Emirates
Afghanistan
Antigua
Anguilla
Albania
Armenia
Netherlands Antilles
Angola
Argentina
American Samoa
Austria
Australia
Aruba
Aland Islands
Azerbaijan
Bosnia
Barbados
Bangladesh
Belgium
Burkina Faso
Bulgaria
Bahrain
Burundi
Benin
Bermuda
Brunei
Bolivia
Brazil
Bahamas
Bhutan
Bouvet Island
Botswana
Belarus
Belize
Canada
Cocos Islands
Congo
Central African Republic
Congo Brazzaville
Switzerland
Cote Divoire
Cook Islands
Chile
Cameroon
China
Colombia
Costa Rica
Serbia
Cuba
Cape Verde
Christmas Island
Cyprus
Czech Republic
Germany
Djibouti
Denmark
Dominica
Dominican Republic
Algeria
Ecuador
Estonia
Egypt
Western Sahara
Eritrea
Spain
Ethiopia
European Union
Finland
Fiji
Falkland Islands
Micronesia
Faroe Islands
France
Gabon
England
Grenada
Georgia
French Guiana
Ghana
Gibraltar
Greenland
Gambia
Guinea
Guadeloupe
Equatorial Guinea
Greece
Sandwich Islands
Guatemala
Guam
Guinea-Bissau
Guyana
Hong Kong
Heard Island
Honduras
Croatia
Haiti
Hungary
Indonesia
Ireland
Israel
India
Indian Ocean Territory
Iraq
Iran
Iceland
Italy
Jamaica
Jordan
Japan
Kenya
Kyrgyzstan
Cambodia
Kiribati
Comoros
Saint Kitts and Nevis
North Korea
South Korea
Kuwait
Cayman Islands
Kazakhstan
Laos
Lebanon
Saint Lucia
Liechtenstein
Sri Lanka
Liberia
Lesotho
Lithuania
Luxembourg
Latvia
Libya
Morocco
Monaco
Moldova
Montenegro
Madagascar
Marshall Islands
MacEdonia
Mali
Burma
Mongolia
MacAu
Northern Mariana Islands
Martinique
Mauritania
Montserrat
Malta
Mauritius
Maldives
Malawi
Mexico
Malaysia
Mozambique
Namibia
New Caledonia
Niger
Norfolk Island
Nigeria
Nicaragua
Netherlands
Norway
Nepal
Nauru
Niue
New Zealand
Oman
Panama
Peru
French Polynesia
New Guinea
Philippines
Pakistan
Poland
Saint Pierre
Pitcairn Islands
Puerto Rico
Palestine
Portugal
Palau
Paraguay
Qatar
Reunion
Romania
Serbia
Russia
Rwanda
Saudi Arabia
Solomon Islands
Seychelles
Sudan
Sweden
Singapore
Saint Helena
Slovenia
Svalbard, I Flag Jan Mayen
Slovakia
Sierra Leone
San Marino
Senegal
Somalia
Suriname
Sao Tome
El Salvador
Syria
Swaziland
Caicos Islands
Chad
French Territories
Togo
Thailand
Tajikistan
Tokelau
Timorleste
Turkmenistan
Tunisia
Tonga
Turkey
Trinidad
Tuvalu
Taiwan
Tanzania
Ukraine
Uganda
Us Minor Islands
United States
Uruguay
Uzbekistan
Vatican City
Saint Vincent
Venezuela
British Virgin Islands
Us Virgin Islands
Vietnam
Vanuatu
Wallis and Futuna
Samoa
Yemen
Mayotte
South Africa
Zambia
Zimbabwe
Select Country
Andorra
United Arab Emirates
Afghanistan
Antigua
Anguilla
Albania
Armenia
Netherlands Antilles
Angola
Argentina
American Samoa
Austria
Australia
Aruba
Aland Islands
Azerbaijan
Bosnia
Barbados
Bangladesh
Belgium
Burkina Faso
Bulgaria
Bahrain
Burundi
Benin
Bermuda
Brunei
Bolivia
Brazil
Bahamas
Bhutan
Bouvet Island
Botswana
Belarus
Belize
Canada
Cocos Islands
Congo
Central African Republic
Congo Brazzaville
Switzerland
Cote Divoire
Cook Islands
Chile
Cameroon
China
Colombia
Costa Rica
Serbia
Cuba
Cape Verde
Christmas Island
Cyprus
Czech Republic
Germany
Djibouti
Denmark
Dominica
Dominican Republic
Algeria
Ecuador
Estonia
Egypt
Western Sahara
Eritrea
Spain
Ethiopia
European Union
Finland
Fiji
Falkland Islands
Micronesia
Faroe Islands
France
Gabon
England
Grenada
Georgia
French Guiana
Ghana
Gibraltar
Greenland
Gambia
Guinea
Guadeloupe
Equatorial Guinea
Greece
Sandwich Islands
Guatemala
Guam
Guinea-Bissau
Guyana
Hong Kong
Heard Island
Honduras
Croatia
Haiti
Hungary
Indonesia
Ireland
Israel
India
Indian Ocean Territory
Iraq
Iran
Iceland
Italy
Jamaica
Jordan
Japan
Kenya
Kyrgyzstan
Cambodia
Kiribati
Comoros
Saint Kitts and Nevis
North Korea
South Korea
Kuwait
Cayman Islands
Kazakhstan
Laos
Lebanon
Saint Lucia
Liechtenstein
Sri Lanka
Liberia
Lesotho
Lithuania
Luxembourg
Latvia
Libya
Morocco
Monaco
Moldova
Montenegro
Madagascar
Marshall Islands
MacEdonia
Mali
Burma
Mongolia
MacAu
Northern Mariana Islands
Martinique
Mauritania
Montserrat
Malta
Mauritius
Maldives
Malawi
Mexico
Malaysia
Mozambique
Namibia
New Caledonia
Niger
Norfolk Island
Nigeria
Nicaragua
Netherlands
Norway
Nepal
Nauru
Niue
New Zealand
Oman
Panama
Peru
French Polynesia
New Guinea
Philippines
Pakistan
Poland
Saint Pierre
Pitcairn Islands
Puerto Rico
Palestine
Portugal
Palau
Paraguay
Qatar
Reunion
Romania
Serbia
Russia
Rwanda
Saudi Arabia
Solomon Islands
Seychelles
Sudan
Sweden
Singapore
Saint Helena
Slovenia
Svalbard, I Flag Jan Mayen
Slovakia
Sierra Leone
San Marino
Senegal
Somalia
Suriname
Sao Tome
El Salvador
Syria
Swaziland
Caicos Islands
Chad
French Territories
Togo
Thailand
Tajikistan
Tokelau
Timorleste
Turkmenistan
Tunisia
Tonga
Turkey
Trinidad
Tuvalu
Taiwan
Tanzania
Ukraine
Uganda
Us Minor Islands
United States
Uruguay
Uzbekistan
Vatican City
Saint Vincent
Venezuela
British Virgin Islands
Us Virgin Islands
Vietnam
Vanuatu
Wallis and Futuna
Samoa
Yemen
Mayotte
South Africa
Zambia
Zimbabwe
Search Dropdown
A dropdown can be searchable
Select Language
Arabic
Chinese
Danish
Dutch
English
French
German
Greek
Hungarian
Italian
Japanese
Korean
Lithuanian
Persian
Polish
Portuguese
Russian
Spanish
Swedish
Turkish
Vietnamese
Search In-Menu
A dropdown can include a search prompt inside its menu
Filter Posts
Tag Label
Important
Announcement
Cannot Fix
Discussion
Inline
A dropdown can be formatted to appear inline in other content
Show me posts trending
today
Today
This Week
This Month
Pointing
A dropdown can be formatted so that its menu is pointing
A dropdown menu or sub-menu can specify the direction it should open
Specifying left on a menu will make all child menus open in the same direction implicitly. To have a dropdown icon appear on the left side on a child menu, you will need to use left dropdown example
Dropdowns support different default actions that can occur when an item is selected. For example, you can set your dropdown not to change its text, or select a value from its menu.
Initializing a dropdown with pre-existing html allows for greater performance than initializing a dropdown directly on a select element.
Any select element initialized as dropdown will also be hidden until javascript can create html, this is to avoid the flash of unstyled content, and the change in element height adjusting page flow.
Gender
Male
Female
$('.ui.dropdown')
.dropdown()
;
Specifying Different Text & Hidden Input Values
You can specify different values for selected text, and selected form values by adding data-text or data-value to any item. This is useful if you include additional data, like icons, that you want to appear only inside the dropdown menu.
Gender
Male
Female
Gender
Male
Female
Converting Form Elements
For convenience, select elements can automatically be converted to selection dropdown. A select options with blank string values will be converted to prompt text.
$('#select')
.dropdown()
;
Hybrid Form Initialization
As a third option, you can include a wrapper around your select so that it will appear correctly on page load, but will then populate the hidden menu when javascript fires. In this case, the select element does not receive the ui dropdown class.
Colors
Sizes
$('#hybrid select')
.dropdown({
on: 'hover'
})
;
Colors
Sizes
Searching Dropdowns
Using a search selection dropdown will allow you users to search more easily through large lists. This can also be converted directly from a form select element.
$('#search-select')
.dropdown()
;
Specifying Select Action
Dropdowns have multiple built-in actions that can occur on item selection, you can specify a built by passing in a value to settings.action that is either a built in action, or a custom function that performs an action.
Action
Description
activate (Default)
Selects current item, adjusts dropdown value and changes dropdown text
select
Selects current item from menu but does not change dropdown text
combo
Same as activate, but updates previous elements text instead of self
hide
Hides the dropdown menu but does nothing
nothing
Does nothing
To specify a different built in action, simply specify the name.
$('.dropdown')
.dropdown({
action: 'combo'
})
;
To trigger only your custom action and no default action, specify your own function for settings.action.
$('.dropdown')
.dropdown({
action: function(text, value) {
// nothing built in occurs
})
})
;
If you want to have both a built in action occur, and your own custom action use onChange in combination with action
Hides all other dropdowns that is not current dropdown
restore defaults
Restores dropdown text and value to its value on page load
restore default text
Restores dropdown text to its value on page load
restore default value
Restores dropdown value to its value on page load
save defaults
Saves current text and value as new defaults (for use with restore)
set selected(value)
Sets selected state to a given value
set text(text)
Sets dropdown text to a value
set value(value)
Sets dropdown input to value (does not update display state)
get text
Returns current dropdown text
get value
Returns current dropdown input value
get item(value)
Returns DOM element that matches a given input value
bind touch events
Adds touch events to element
mouse events
Adds mouse events to element
bind intent
Binds a click to document to determine if you click away from a dropdown
unbind intent
Unbinds document intent click
determine intent
Returns whether event occurred inside dropdown
determine select action(text, value)
Triggers preset item selection action based on settings passing text/value
set active
Sets dropdown to active state
set visible
Sets dropdown to visible state
remove active
rRemoves dropdown active state
remove visible
Removes dropdown visible state
is selection
Returns whether dropdown is a selection dropdown
is animated
Returns whether dropdown is animated
is visible
Returns whether dropdown is visible
is hidden
Returns whether dropdown is hidden
Dropdown
Behavior
Setting
Default
Description
action
auto
Sets a default action to occur. (See usage guide)
activate (default)
Updates dropdown text with selected value, sets element state to active, updates any hidden fields if available
select
activates menu and updates input fields, but does not change current text
combo
changes text of previous sibling element
nothing
no action occurs
hide
Dropdown menu is hidden
function(text, value){}
custom function is executed with values specified in callback
on
click
Event used to trigger dropdown (Hover, Click, Custom Event)
allowCategorySelection
false
Whether menu items with sub-menus (categories) should be selectable
forceSelection
true
Whether search selection will force currently selected choice when element is blurred.
sortSelect
false
Whether to sort values when creating a dropdown automatically from a select element.
allowTab
true
Whether to allow a tabindex to be created for this element
fullTextSearch
false
Whether search selections should look for string match anywhere in string
preserveHTML
true
Whether html included in dropdown values should be preserved. (Allows icons to show up in selected value)
delay
delay: {
show : 200,
hide : 300,
touch : 50
},
Time in milliseconds to debounce show or hide behavior when on: hover is used, or when touch is used.
transition
auto (slide down / slide up)
Named transition to use when animating menu in and out. Defaults to slide down or slide up depending on dropdown direction. Fade and slide down are available without including ui transitions
duration
250
Duration of animation events
Callbacks
Context
Description
onChange(value, text, $choice)
Dropdown
Is called after a dropdown item is selected. receives the name and value of selection and the active menu element
onNoResults(searchValue)
Dropdown
Is called after a dropdown is searched with no matching values
onShow
Dropdown
Is called after a dropdown is shown.
onHide
Dropdown
Is called after a dropdown is hidden.
Module Settings
DOM Settings
DOM settings specify how this module should interface with the DOM
Default
Description
namespace
dropdown
Event namespace. Makes sure module teardown does not effect other events attached to an element.
error : {
action : 'You called a dropdown action that was not defined',
method : 'The method you called is not defined.',
transition : 'The requested transition was not found'
}
The Translation Needs Your Help
This translation is only % complete!
We need your help to make Semantic available to people who speak your language.
Our translation tools are easy to use and allow you to translate text without having to leave the site.
Semantic is available at semantic-ui.cn a mirror site hosted inside China. This should make browsing much faster for those visiting from mainland China.