ComboBox - Documentation | www.HtmlElements.com

Overview

Smart.ComboBox represents an input with a dropdown list of items.

Getting Started with ComboBox Web Component

Smart UI for Web Components is distributed as smart-webcomponents NPM package. You can also get the full download from our website with all demos from the Download page.

Setup the ComboBox

Smart UI for Web Components is distributed as smart-webcomponents NPM package

  1. Download and install the package.

    npm install smart-webcomponents

  2. Once installed, import the ComboBox module in your application.

    <script type="module" src="node_modules/smart-webcomponents/source/modules/smart.combobox.js"></script>

  3. Adding CSS reference

    The smart.default.css CSS file should be referenced using following code.

    <link rel="stylesheet" type="text/css" href="node_modules/smart-webcomponents/source/styles/smart.default.css" />

  4. Add the ComboBox tag to your Web Page

    <smart-combo-box id="combobox"></smart-combo-box>

  5. Create the ComboBox Component

    	<script type="module">
    		Smart('#combobox', class {
    			get properties() {
    				return { selectionMode: "one" }
    			}
    		});
    	</script>	   
    		

    Another option is to create the ComboBox is by using the traditional Javascript way:
    	const combobox = document.createElement('smart-combo-box');
    
    	combobox.disabled = true;
    	document.body.appendChild(combobox);
    		

    Smart framework provides a way to dynamically create a web component on demand from a DIV tag which is used as a host. The following imports the web component's module and creates it on demand, when the document is ready. The #combobox is the ID of a DIV tag.

    	import "../../source/modules/smart.combobox.js";
    
    	document.readyState === 'complete' ? init() : window.onload = init;
    
    	function init() { 
    		const combobox = new Smart.ComboBox('#combobox', { selectionMode: "one" });
    	}
    	

  6. Open the page in your web server.

Appearance

Smart.ComboBox allows to completely customize the content of the list items.

In order to change the content of an item, itemTemplate property has to be applied by assigning the id of an HTML Template element that's located inside the DOM. Here's an example:

<!DOCTYPE html>
<html lang="en">
<head>
 <link rel="stylesheet" href="../../source/styles/smart.default.css" type="text/css" />
 <script type="text/javascript" src="../../source/smart.elements.js"></script>
</head>
<body>
 <template id="template">
     <span class="glyphicon glyphicon-ok"></span>
     <span> {{label}}</span>
 </template>

 <smart-combo-box item-template="template">
     <smart-list-item selected value="1">Item 1</smart-list-item>
     <smart-list-item value="2">Item 2</smart-list-item>
     <smart-list-item value="3">Item 3</smart-list-item>
 </smart-combo-box>
</body>
</html>

The template contains a binding field surrounded by curly braces {{ label }}. The text between the breckets can be random.

Demo

Smart.ComboBox has the abbility to behave like a simple input field or an input field with a separate drop down button. The dropDownOpenMode property determines how the drop down will open. The element can have two separate buttons: an action and a dropDown button if the property is set to 'dropDownButton'.

Available modes for dropDownOpenMode:

  • none - the popup doesn't open.
  • default - opens if the user clicks on the dropDownButton
  • dropDownButton - the input and the button behave like two separate elements. The drop down button becomes focusable using keyboard interaction.
  • auto - the drop down popup opens when the mouse is over the element and closes when not.
<smart-combo-box drop-down-open-mode="dropDownButton">
     <smart-list-item >Item 1</smart-list-item>
     <smart-list-item selected>Item 2</smart-list-item>
     <smart-list-item>Item 3</smart-list-item>
     <smart-list-item>Item 4</smart-list-item>
     <smart-list-item>Item 5</smart-list-item>
 </smart-combo-box>

Demo

Data Binding

Adding data to the Combo box can be accomplished in a few ways:

  • Nesting Smart.ListItem elements inside the Combo box's body in the HTML:
     <smart-combo-box>
         <smart-list-item value="value1">Item1</smart-list-item>
         <smart-list-item selected value="value2">Item2</smart-list-item>
         <smart-list-item value="value3">Item3</smart-list-item>
     </smart-combo-box>

    Demo

    Smart.ListItem has a label and a value property. The value property can have a separate value from the label or no value at all. The user can prefer to apply a value only to the label and it will be automatically assigned to value as well.

    The text inside the list item represents the value of the label property. It can also be set in the HTML code like shown in the example above.


  • Nesting Smart.ListItemGroup elements inside the ComboBox's body in the HTML:
    <smart-combo-box>
        <smart-list-items-group label="Group 1">
            <smart-list-item>Item 1</smart-list-item>
            <smart-list-item>Item 2</smart-list-item>
            <smart-list-item>Item 3</smart-list-item>
        </smart-list-items-group>
        <smart-list-items-group label="Group 2">
            <smart-list-item>Item 4</smart-list-item>
            <smart-list-item>Item 5</smart-list-item>
            <smart-list-item>Item 6</smart-list-item>
        </smart-list-items-group>
        <smart-list-items-group label="Group 3">
            <smart-list-item>Item 7</smart-list-item>
            <smart-list-item>Item 8</smart-list-item>
            <smart-list-item>Item 9</smart-list-item>
        </smart-list-items-group>
    </smart-combo-box>
    

    Smart.ListItemGroup represents a group of items.

    Grouping can also be enabled later via javascript by applying the grouped property.

    Demo

  • Nesting HTML list elements inside the Combo box's body in the HTML:
    <smart-combo-box>
         <ul label="Group 1">
             <li>Item 1</li>
             <li>Item 2</li>
             <li>Item 3</li>
             <li>Item 4</li>
             <li>Item 5</li>
         </ul>
         <ul label="Group 2">
             <li>Item 6</li>
             <li>Item 7</li>
             <li>Item 8</li>
             <li>Item 9</li>
             <li>Item 10</li>
         </ul>
     </smart-combo-box>
    

    List items can be added without the ul tag. The grouping can be added at a later stage by setting the grouped property to the element.

    Demo

  • Nesting optgroup elements inside the Combo box's body in the HTML:
    <smart-combo-box>
         <optgroup label="Group 1">
             <option value="1">Item 1</option>
             <option value="2">Item 2</option>
         </optgroup>
         <optgroup label="Group 2">
             <option value="3">Item 3</option>
             <option value="4">Item 4</option>
         </optgroup>
     </smart-combo-box>
    

    optgroups are the items of an HTML select element. As usual the value attribute can be applied to each list item to assign a specific value that can differ from the label.

    Demo

  • Setting the dataSource property of the element to a new value of type Array.

    The property can be changed dynamically via javascript after the element has been initialized:

    <!DOCTYPE html>
    <html>
    <head>
     <link rel="stylesheet" href=../../source/styles/smart.default.css" type="text/css" />
     <script type="text/javascript" src="../../source/smart.elements.js"></script>
     <script>
     window.onload = function () {
         document.querySelector('smart-combo-box').dataSource =
             [
                 "Item 1",
                 "Item 2",
                 "Item 3"
             ];
         }
     </script>
    </head>
    <body>
     <smart-combo-box></smart-combo-box>
    </body>
    </html>

    Demo

    dataSource accepts Arrays of strings or Objects. An object can contain more specific data for the items. For example:

    <!DOCTYPE html>
    <html>
    <head>
     <link rel="stylesheet" href=../../source/styles/smart.default.css" type="text/css" />
     <script type="text/javascript" src="../../source/smart.elements.js"></script>
     <script>
     window.onload = function () {
         var comboBox = document.querySelector('smart-combo-box');
    
         comboBox.dataSource = [
             {
                 label: 'Item 1',
                 value: 1
             },
             {
                 label: 'Item 2',
                 value: 2
             },
             {
                 label: 'Item 3',
                 value: 3,
                 disabled: true
             },
             {
                 label: 'Item 4',
                 value: 4
             },
             {
                 label: 'Item 5',
                 value: 5
             },
         ];
     } 
     </script>
    </head>
    <body>
     <smart-combo-box></smart-combo-box>
    </body>
    </html>
    

    Demo

    Like every other custom element property, dataSource can also be set from the HTML in the tag of the element, like so:

    <smart-combo-box data-source='["Item1", "Item2", "Item3"]'></smart-combo-box>

    Demo


Manipulating the content

The element offers the following methods:

  • Insert method can create and insert new list items into the element.

    The insert method can be called at any time after the element has been initialized.

    The method accepts two arguments:

    1. The index at which the item will be inserted.
    2. An array of strings or a single string representing the labels of the items to be inserted.

    <!DOCTYPE html>
    <html>
    <head>
     <link rel="stylesheet" href=../../source/styles/smart.default.css" type="text/css" />
     <script type="text/javascript" src="../../source/smart.elements.js"></script>
     <script>
         window.onload = function () {
             var comboBox = document.querySelector('smart-combo-box');
    
             comboBox.insert(0, ["Item1", "Item2", "Item3"]);
             comboBox.insert(2, 'Item4');
         }
     </script>
    </head>
    <body>
     <smart-combo-box></smart-combo-box>
    </body>
    </html>

    Demo

  • Update method allow List items to be modified after creation.

    Update method accepts two arguments:
    1. The index of the item to be updated.
    2. Details for the item. This argument can be an object containing properties of smartListItem, e.g. label, value, disabled. It can also be a simple string that represents the new label of the item that will be updated.

    <!DOCTYPE html>
    <html>
    <head>
     <link rel="stylesheet" href=../../source/styles/smart.default.css" type="text/css" />
     <script type="text/javascript" src="../../source/smart.elements.js"></script>
     <script>
         window.onload = function () {
             var comboBox = document.querySelector('smart-combo-box');
    
             //Create items
             comboBox.insert(0, ["Item1", "Item2", "Item3"]);
             comboBox.insert(2, 'Item4');
    
             //Update items
             comboBox.update(1, 'Item12');
             comboBox.update(2, { label: 'Item13', value: '13', disabled: true });
         }
     </script>
    </head>
    <body>
     <smart-combo-box></smart-combo-box>
    </body>
    </html>

    Demo

  • Remove deletes an item from the element. The method accepts a single argument - the index of the item to be removed.

    Here's an example:

    <!DOCTYPE html>
    <html>
    <head>
     <link rel="stylesheet" href=../../source/styles/smart.default.css" type="text/css" />
     <script type="text/javascript" src="../../source/smart.elements.js"></script>
     <script>
         window.onload = function () {
             var comboBox = document.querySelector('smart-combo-box');
    
             //Create items
             comboBox.insert(0, ["Item1", "Item2", "Item3"]);
             comboBox.insert(2, 'Item4');
    
             //Update items
             comboBox.update(1, 'Item12');
             comboBox.update(2, { label: 'Item13', value: '13', disabled: true });
    
             //Remove items
             comboBox.remove(2);
             comboBox.remove(0);
         }
     </script>
    </head>
    <body>
     <smart-combo-box></smart-combo-box>
    </body>
    </html>

    Demo

  • clearItems removes all items from the element. Takes no arguments:
    window.onload = function () {
        var comboBox = document.querySelector('smart-combo-box');
    
        comboBox.clearItems();
    }
    

Behavior

Smart.ComboBox offers different drop down positions: bottom, top, overlay-center, overlay-bottom, overlay-top, center-top, center-bottom and auto. The position of the listBox drop down can be modified via the dropDownPosition property, like so:

<!DOCTYPE html>
<html>
<head>
 <link rel="stylesheet" href=../../source/styles/smart.default.css" type="text/css" />
 <script type="text/javascript" src="../../source/smart.elements.js"></script>
 <script>
     window.onload = function () {
         var comboBox = document.querySelector('smart-combo-box');

         comboBox.dropDownPosition = 'top';
     }
 </script>
</head>
<body>
 <smart-combo-box>
    <smart-list-item>Item 1</smart-list-item>
    <smart-list-item>Item 2</smart-list-item>
    <smart-list-item>Item 3</smart-list-item>
 </smart-combo-box>
</body>
</html>

Demo

Similar to any other property dropDownPosition can be set in the HTML with an attribute:

<smart-combo-box drop-down-position="bottom">
    <smart-list-item>Item 1</smart-list-item>
    <smart-list-item>Item 2</smart-list-item>
    <smart-list-item>Item 3</smart-list-item>
</smart-combo-box>

Demo

The default value of the property is 'auto'. This means that the element will automatically determine the position of the drop down depending on the space available. The algorithm always starts by trying to place the drop down below the element. If there's no space available it moves it above the element.

Create, Append, Remove, Get/Set Property, Invoke Method, Bind to Event


Create a new element:
	const combobox = document.createElement('smart-combo-box');
	

Append it to the DOM:
	document.body.appendChild(combobox);
	

Remove it from the DOM:
	combobox.parentNode.removeChild(combobox);
	

Set a property:
	combobox.propertyName = propertyValue;
	

Get a property value:
	const propertyValue = combobox.propertyName;
	

Invoke a method:
	combobox.methodName(argument1, argument2);
	

Add Event Listener:
	const eventHandler = (event) => {
	   // your code here.
	};

	combobox.addEventListener(eventName, eventHandler);
	

Remove Event Listener:
	combobox.removeEventListener(eventName, eventHandler, true);
	

Using with Typescript

Smart Web Components package includes TypeScript definitions which enables strongly-typed access to the Smart UI Components and their configuration.

Inside the download package, the typescript directory contains .d.ts file for each web component and a smart.elements.d.ts typescript definitions file for all web components. Copy the typescript definitions file to your project and in your TypeScript file add a reference to smart.elements.d.ts

Read more about using Smart UI with Typescript.

Getting Started with Angular ComboBox Component

Setup Angular Environment

Angular provides the easiest way to set angular CLI projects using Angular CLI tool.

Install the CLI application globally to your machine.

npm install -g @angular/cli

Create a new Application

ng new smart-angular-combobox

Navigate to the created project folder

cd smart-angular-combobox

Setup the ComboBox

Smart UI for Angular is distributed as smart-webcomponents-angular NPM package

  1. Download and install the package.
    npm install smart-webcomponents-angular
  2. Once installed, import the ComboBoxModule in your application root or feature module.

    app.module.ts

    import { NgModule } from '@angular/core';
    import { BrowserModule } from '@angular/platform-browser';
    
    import { ComboBoxModule } from 'smart-webcomponents-angular/combobox';
    
    import { AppComponent } from './app.component';
    
    @NgModule({
        declarations: [ AppComponent ],
        imports: [ BrowserModule, ComboBoxModule ],
        bootstrap: [ AppComponent ],
    	entryComponents: [ AppComponent ]
    })
    
    export class AppModule { }
    	

  3. Adding CSS reference

    The following CSS file is available in ../node_modules/smart-webcomponents-angular/ package folder. This can be referenced in [src/styles.css] using following code.

    	@import 'smart-webcomponents-angular/source/styles/smart.default.css';

    Another way to achieve the same is to edit the angular.json file and in the styles add the style.

    	"styles": [
    		"node_modules/smart-webcomponents-angular/source/styles/smart.default.css"
    	]
    	
  4. Example


    app.component.html

     
    <smart-combo-box #combobox [selectedValues]="['Cappuccino']">
        <smart-list-item [value]="'1'">Affogato</smart-list-item>
        <smart-list-item [value]="'2'">Americano</smart-list-item>
        <smart-list-item [value]="'3'">Bicerin</smart-list-item>
        <smart-list-item [value]="'4'">Breve</smart-list-item>
        <smart-list-item [value]="'5'">Cappuccino</smart-list-item>
        <smart-list-item [value]="'6'">Cafe Crema</smart-list-item>
        <smart-list-item [value]="'7'">Cafe Corretto</smart-list-item>
        <smart-list-item [value]="'8'">Cafe macchiato</smart-list-item>
        <smart-list-item [value]="'9'">Cafe mocha</smart-list-item>
        <smart-list-item [value]="'10'">Cortado</smart-list-item>
        <smart-list-item [value]="'11'">Cuban espresso</smart-list-item>
        <smart-list-item [value]="'12'">Espresso</smart-list-item>
        <smart-list-item [value]="'13'">Eiskaffee</smart-list-item>
        <smart-list-item [value]="'14'">Frappuccino</smart-list-item>
        <smart-list-item [value]="'15'">Galao</smart-list-item>
        <smart-list-item [value]="'16'">Greek frappe coffee</smart-list-item>
        <smart-list-item [value]="'17'">Iced Coffee</smart-list-item>
        <smart-list-item [value]="'18'">Instant Coffee</smart-list-item>
        <smart-list-item [value]="'19'">Latte</smart-list-item>
        <smart-list-item [value]="'20'">Liqueur coffee</smart-list-item>
    </smart-combo-box>
    		

    app.component.ts

     
    import { Component, ViewChild, OnInit, AfterViewInit } from '@angular/core';
    import { ComboBoxComponent } from 'smart-webcomponents-angular/combobox';
    
    
    @Component({
        selector: 'app-root',
        templateUrl: './app.component.html',
    	styleUrls: ['./app.component.css']
    })
    
    export class AppComponent implements AfterViewInit, OnInit {	
    	@ViewChild('combobox', { read: ComboBoxComponent, static: false }) combobox: ComboBoxComponent;
    	
     
    	ngOnInit(): void {
    		// onInit code.
    	}
    
    	ngAfterViewInit(): void {
    		// afterViewInit code.
    		this.init();
        }
    		
    	init(): void {
    		// init code.
    	    
    
    	}	
    }
    		

    app.module.ts

     
    import { NgModule } from '@angular/core';
    import { BrowserModule } from '@angular/platform-browser';
    
    import { ComboBoxModule } from 'smart-webcomponents-angular/combobox';
    
    import { AppComponent } from './app.component';
    
    @NgModule({
        declarations: [ AppComponent ],
        imports: [ BrowserModule, ComboBoxModule ],
        bootstrap: [ AppComponent ],
    	entryComponents: [ AppComponent ]
    })
    
    export class AppModule { }
    		


Running the Angular application

After completing the steps required to render a ComboBox, run the following command to display the output in your web browser

ng serve
and open localhost:4200 in your favorite web browser.

Read more about using Smart UI for Angular: https://www.htmlelements.com/docs/angular-cli/.

Getting Started with React ComboBox Component

Setup React Environment

The easiest way to start with React is to use create-react-app. To scaffold your project structure, follow the installation instructions.

	npm install -g create-react-app
	create-react-app my-app
	cd my-app
	npm start
	

Preparation

Open src/App.js andsrc/App.css

  1. Remove everything inside the App div tag in src/App.js:
    <div className="App"> </div>
  2. Remove the logo.svg import
  3. Remove the contents of src/App.css
  4. Remove src/logo.svg

Setup the ComboBox

Smart UI for React is distributed as smart-webcomponents-react NPM package

  1. Download and install the package.
    npm install smart-webcomponents-react
  2. Once installed, import the React ComboBox Component and CSS files in your application and render it app.js

    import 'smart-webcomponents-react/source/styles/smart.default.css';
    import React from "react";
    import ReactDOM from "react-dom";
    import { ComboBox, ListItem, ListItemsGroup } from 'smart-webcomponents-react/combobox';
    
    class App extends React.Component {
    
    	init() {
    	
    	}
    
    
    	componentDidMount() {
    
    	}
    
    	render() {
    		return (
    			<div>
    			    <ComboBox ref="combobox" selectedValues={["Cappuccino"]}>
    			        <ListItem value="1">Affogato</ListItem>
    			        <ListItem value="2">Americano</ListItem>
    			        <ListItem value="3">Bicerin</ListItem>
    			        <ListItem value="4">Breve</ListItem>
    			        <ListItem value="5">Cappuccino</ListItem>
    			        <ListItem value="6">Cafe Crema</ListItem>
    			        <ListItem value="7">Cafe Corretto</ListItem>
    			        <ListItem value="8">Cafe macchiato</ListItem>
    			        <ListItem value="9">Cafe mocha</ListItem>
    			        <ListItem value="10">Cortado</ListItem>
    			        <ListItem value="11">Cuban espresso</ListItem>
    			        <ListItem value="12">Espresso</ListItem>
    			        <ListItem value="13">Eiskaffee</ListItem>
    			        <ListItem value="14">Frappuccino</ListItem>
    			        <ListItem value="15">Galao</ListItem>
    			        <ListItem value="16">Greek frappe coffee</ListItem>
    			        <ListItem value="17">Iced Coffee</ListItem>
    			        <ListItem value="18">Instant Coffee</ListItem>
    			        <ListItem value="19">Latte</ListItem>
    			        <ListItem value="20">Liqueur coffee</ListItem>
    			    </ComboBox>
    			</div>
    		);
    	}
    }
    
    ReactDOM.render(<App />, document.querySelector("#root"));
    
    export default App;
    	

Running the React application

Start the app with
npm start
and open localhost:3000 in your favorite web browser to see the output.

Read more about using Smart UI for React: https://www.htmlelements.com/docs/react/.

Getting Started with Vue ComboBox Component


Setup Vue Environment

We will use vue-cli to get started. Let's install vue-cli

npm install -g @vue/cli

Then we can start creating our Vue.js projects with:

vue create my-project

Setup the ComboBox

Open the "my-project" folder and run:

npm install smart-webcomponents

Setup with Vue 3.x

  • Make Vue ignore custom elements defined outside of Vue (e.g., using the Web Components APIs). Otherwise, it will throw a warning about an Unknown custom element, assuming that you forgot to register a global component or misspelled a component name.

    Open src/main.js in your favorite text editor and change its contents to the following:

    main.js

    import { createApp } from 'vue'
    import App from './App.vue'
    
    const app = createApp(App)
    
    app.config.isCustomElement = tag => tag.startsWith('smart-');
    app.mount('#app')
    		
  • Open src/App.vue in your favorite text editor and change its contents to the following:

    App.vue

    <template>
      <div class="vue-root">
        <smart-combo-box selected-values="['Cappuccino']">
          <smart-list-item value="1">Affogato</smart-list-item>
          <smart-list-item value="2">Americano</smart-list-item>
          <smart-list-item value="3">Bicerin</smart-list-item>
          <smart-list-item value="4">Breve</smart-list-item>
          <smart-list-item value="5">Cappuccino</smart-list-item>
          <smart-list-item value="6">Cafe Crema</smart-list-item>
          <smart-list-item value="7">Cafe Corretto</smart-list-item>
          <smart-list-item value="8">Cafe macchiato</smart-list-item>
          <smart-list-item value="9">Cafe mocha</smart-list-item>
          <smart-list-item value="10">Cortado</smart-list-item>
          <smart-list-item value="11">Cuban espresso</smart-list-item>
          <smart-list-item value="12">Espresso</smart-list-item>
          <smart-list-item value="13">Eiskaffee</smart-list-item>
          <smart-list-item value="14">Frappuccino</smart-list-item>
          <smart-list-item value="15">Galao</smart-list-item>
          <smart-list-item value="16">Greek frappe coffee</smart-list-item>
          <smart-list-item value="17">Iced Coffee</smart-list-item>
          <smart-list-item value="18">Instant Coffee</smart-list-item>
          <smart-list-item value="19">Latte</smart-list-item>
          <smart-list-item value="20">Liqueur coffee</smart-list-item>
        </smart-combo-box>
      </div>
    </template>
    
    <script>
    import { onMounted } from "vue";
    import "smart-webcomponents/source/styles/smart.default.css";
    import "smart-webcomponents/source/modules/smart.combobox.js";
    
    export default {
      name: "app",
      setup() {
        onMounted(() => {});
      }
    };
    </script>
    
    <style>
    smart-combo-box {
      width: 300px;
    }
    </style>
    		
    We can now use the smart-combo-box with Vue 3. Data binding and event handlers will just work right out of the box.

Setup with Vue 2.x

  • Make Vue ignore custom elements defined outside of Vue (e.g., using the Web Components APIs). Otherwise, it will throw a warning about an Unknown custom element, assuming that you forgot to register a global component or misspelled a component name.

    Open src/main.js in your favorite text editor and change its contents to the following:

    main.js

    import Vue from 'vue'
    import App from './App.vue'
    
    Vue.config.productionTip = false
    Vue.config.ignoredElements = [
    'smart-combo-box', 
    'smart-list-item', 
    'smart-list-items-group'
    ]
    
    new Vue({
      render: h => h(App),
    }).$mount('#app')
  • Open src/App.vue in your favorite text editor and change its contents to the following:

    App.vue

    <template>
      <smart-combo-box>
        <smart-list-item value="Afghanistan">Afghanistan</smart-list-item>
        <smart-list-item selected value="Albania">Albania</smart-list-item>
        <smart-list-item value="Algeria">Algeria</smart-list-item>
        <smart-list-item value="American Samoa">American Samoa</smart-list-item>
        <smart-list-item value="Andorra">Andorra</smart-list-item>
        <smart-list-item value="Angola">Angola</smart-list-item>
        <smart-list-item value="Anguilla">Anguilla</smart-list-item>
        <smart-list-item value="Antarctica">Antarctica</smart-list-item>
        <smart-list-item value="Antigua and Barbuda">Antigua and Barbuda</smart-list-item>
        <smart-list-item value="Argentina">Argentina</smart-list-item>
        <smart-list-item value="Armenia">Armenia</smart-list-item>
        <smart-list-item value="Aruba">Aruba</smart-list-item>
        <smart-list-item value="Australia">Australia</smart-list-item>
        <smart-list-item value="Austria">Austria</smart-list-item>
        <smart-list-item value="Azerbaijan">Azerbaijan</smart-list-item>
        <smart-list-item value="Bahamas">Bahamas</smart-list-item>
        <smart-list-item value="Bahrain">Bahrain</smart-list-item>
        <smart-list-item value="Bangladesh">Bangladesh</smart-list-item>
        <smart-list-item value="Barbados">Barbados</smart-list-item>
        <smart-list-item value="Belarus">Belarus</smart-list-item>
        <smart-list-item value="Belgium">Belgium</smart-list-item>
        <smart-list-item value="Belize">Belize</smart-list-item>
        <smart-list-item value="Benin">Benin</smart-list-item>
        <smart-list-item value="Bermuda">Bermuda</smart-list-item>
        <smart-list-item value="Bhutan">Bhutan</smart-list-item>
        <smart-list-item value="Bolivia">Bolivia</smart-list-item>
        <smart-list-item value="Bosnia and Herzegovina">Bosnia and Herzegovina</smart-list-item>
        <smart-list-item value="Botswana">Botswana</smart-list-item>
        <smart-list-item value="Bouvet Island">Bouvet Island</smart-list-item>
        <smart-list-item value="Brazil">Brazil</smart-list-item>
        <smart-list-item value="British Indian Ocean Territory">British Indian Ocean Territory</smart-list-item>
        <smart-list-item value="Brunei Darussalam">Brunei Darussalam</smart-list-item>
        <smart-list-item value="Bulgaria">Bulgaria</smart-list-item>
        <smart-list-item value="Burkina Faso">Burkina Faso</smart-list-item>
        <smart-list-item value="Burundi">Burundi</smart-list-item>
        <smart-list-item value="Cambodia">Cambodia</smart-list-item>
        <smart-list-item value="Cameroon">Cameroon</smart-list-item>
        <smart-list-item value="Canada">Canada</smart-list-item>
        <smart-list-item value="Cape Verde">Cape Verde</smart-list-item>
        <smart-list-item value="Cayman Islands">Cayman Islands</smart-list-item>
        <smart-list-item value="Central African Republic">Central African Republic</smart-list-item>
        <smart-list-item value="Chad">Chad</smart-list-item>
        <smart-list-item value="Chile">Chile</smart-list-item>
        <smart-list-item value="China">China</smart-list-item>
        <smart-list-item value="Christmas Island">Christmas Island</smart-list-item>
        <smart-list-item value="Cocos (Keeling) Islands">Cocos Islands</smart-list-item>
        <smart-list-item value="Colombia">Colombia</smart-list-item>
        <smart-list-item value="Comoros">Comoros</smart-list-item>
        <smart-list-item value="Congo">Congo</smart-list-item>
        <smart-list-item value="Congo, The Democratic Republic of The">Congo</smart-list-item>
        <smart-list-item value="Cook Islands">Cook Islands</smart-list-item>
        <smart-list-item value="Costa Rica">Costa Rica</smart-list-item>
        <smart-list-item value="Cote D'ivoire">Cote D'ivoire</smart-list-item>
        <smart-list-item value="Croatia">Croatia</smart-list-item>
        <smart-list-item value="Cuba">Cuba</smart-list-item>
        <smart-list-item value="Cyprus">Cyprus</smart-list-item>
        <smart-list-item value="Czech Republic">Czech Republic</smart-list-item>
        <smart-list-item value="Denmark">Denmark</smart-list-item>
        <smart-list-item value="Djibouti">Djibouti</smart-list-item>
        <smart-list-item value="Dominica">Dominica</smart-list-item>
        <smart-list-item value="Dominican Republic">Dominican Republic</smart-list-item>
        <smart-list-item value="Ecuador">Ecuador</smart-list-item>
        <smart-list-item value="Egypt">Egypt</smart-list-item>
        <smart-list-item value="El Salvador">El Salvador</smart-list-item>
        <smart-list-item value="Equatorial Guinea">Equatorial Guinea</smart-list-item>
        <smart-list-item value="Eritrea">Eritrea</smart-list-item>
        <smart-list-item value="Estonia">Estonia</smart-list-item>
        <smart-list-item value="Ethiopia">Ethiopia</smart-list-item>
        <smart-list-item value="Falkland Islands (Malvinas)">Falkland Islands</smart-list-item>
        <smart-list-item value="Faroe Islands">Faroe Islands</smart-list-item>
        <smart-list-item value="Fiji">Fiji</smart-list-item>
        <smart-list-item value="Finland">Finland</smart-list-item>
        <smart-list-item value="France">France</smart-list-item>
        <smart-list-item value="French Guiana">French Guiana</smart-list-item>
        <smart-list-item value="French Polynesia">French Polynesia</smart-list-item>
        <smart-list-item value="French Southern Territories">French Southern Territories</smart-list-item>
        <smart-list-item value="Gabon">Gabon</smart-list-item>
        <smart-list-item value="Gambia">Gambia</smart-list-item>
        <smart-list-item value="Georgia">Georgia</smart-list-item>
        <smart-list-item value="Germany">Germany</smart-list-item>
        <smart-list-item value="Ghana">Ghana</smart-list-item>
        <smart-list-item value="Gibraltar">Gibraltar</smart-list-item>
        <smart-list-item value="Greece">Greece</smart-list-item>
        <smart-list-item value="Greenland">Greenland</smart-list-item>
        <smart-list-item value="Grenada">Grenada</smart-list-item>
        <smart-list-item value="Guadeloupe">Guadeloupe</smart-list-item>
        <smart-list-item value="Guam">Guam</smart-list-item>
        <smart-list-item value="Guatemala">Guatemala</smart-list-item>
        <smart-list-item value="Guinea">Guinea</smart-list-item>
        <smart-list-item value="Guinea-bissau">Guinea-bissau</smart-list-item>
        <smart-list-item value="Guyana">Guyana</smart-list-item>
        <smart-list-item value="Haiti">Haiti</smart-list-item>
        <smart-list-item value="Heard Island and Mcdonald Islands">Heard Island and Mcdonald Islands</smart-list-item>
        <smart-list-item value="Holy See (Vatican City State)">Holy See</smart-list-item>
        <smart-list-item value="Honduras">Honduras</smart-list-item>
        <smart-list-item value="Hong Kong">Hong Kong</smart-list-item>
        <smart-list-item value="Hungary">Hungary</smart-list-item>
        <smart-list-item value="Iceland">Iceland</smart-list-item>
        <smart-list-item value="India">India</smart-list-item>
        <smart-list-item value="Indonesia">Indonesia</smart-list-item>
        <smart-list-item value="Iran, Islamic Republic of">Iran</smart-list-item>
        <smart-list-item value="Iraq">Iraq</smart-list-item>
        <smart-list-item value="Ireland">Ireland</smart-list-item>
        <smart-list-item value="Israel">Israel</smart-list-item>
        <smart-list-item value="Italy">Italy</smart-list-item>
        <smart-list-item value="Jamaica">Jamaica</smart-list-item>
        <smart-list-item value="Japan">Japan</smart-list-item>
        <smart-list-item value="Jordan">Jordan</smart-list-item>
        <smart-list-item value="Kazakhstan">Kazakhstan</smart-list-item>
        <smart-list-item value="Kenya">Kenya</smart-list-item>
        <smart-list-item value="Kiribati">Kiribati</smart-list-item>
        <smart-list-item value="Korea, Democratic People's Republic of">Korea</smart-list-item>
        <smart-list-item value="Korea, Republic of">Korea, Republic of</smart-list-item>
        <smart-list-item value="Kuwait">Kuwait</smart-list-item>
        <smart-list-item value="Kyrgyzstan">Kyrgyzstan</smart-list-item>
        <smart-list-item value="Lao People's Democratic Republic">Lao People's Democratic Republic</smart-list-item>
        <smart-list-item value="Latvia">Latvia</smart-list-item>
        <smart-list-item value="Lebanon">Lebanon</smart-list-item>
        <smart-list-item value="Lesotho">Lesotho</smart-list-item>
        <smart-list-item value="Liberia">Liberia</smart-list-item>
        <smart-list-item value="Libyan Arab Jamahiriya">Libyan Arab Jamahiriya</smart-list-item>
        <smart-list-item value="Liechtenstein">Liechtenstein</smart-list-item>
        <smart-list-item value="Lithuania">Lithuania</smart-list-item>
        <smart-list-item value="Luxembourg">Luxembourg</smart-list-item>
        <smart-list-item value="Macao">Macao</smart-list-item>
        <smart-list-item value="Macedonia, The Former Yugoslav Republic of">Macedonia</smart-list-item>
        <smart-list-item value="Madagascar">Madagascar</smart-list-item>
        <smart-list-item value="Malawi">Malawi</smart-list-item>
        <smart-list-item value="Malaysia">Malaysia</smart-list-item>
        <smart-list-item value="Maldives">Maldives</smart-list-item>
        <smart-list-item value="Mali">Mali</smart-list-item>
        <smart-list-item value="Malta">Malta</smart-list-item>
        <smart-list-item value="Marshall Islands">Marshall Islands</smart-list-item>
        <smart-list-item value="Martinique">Martinique</smart-list-item>
        <smart-list-item value="Mauritania">Mauritania</smart-list-item>
        <smart-list-item value="Mauritius">Mauritius</smart-list-item>
        <smart-list-item value="Mayotte">Mayotte</smart-list-item>
        <smart-list-item value="Mexico">Mexico</smart-list-item>
        <smart-list-item value="Micronesia, Federated States of">Micronesia</smart-list-item>
        <smart-list-item value="Moldova, Republic of">Moldova, Republic of</smart-list-item>
        <smart-list-item value="Monaco">Monaco</smart-list-item>
        <smart-list-item value="Mongolia">Mongolia</smart-list-item>
        <smart-list-item value="Montserrat">Montserrat</smart-list-item>
        <smart-list-item value="Morocco">Morocco</smart-list-item>
        <smart-list-item value="Mozambique">Mozambique</smart-list-item>
        <smart-list-item value="Myanmar">Myanmar</smart-list-item>
        <smart-list-item value="Namibia">Namibia</smart-list-item>
        <smart-list-item value="Nauru">Nauru</smart-list-item>
        <smart-list-item value="Nepal">Nepal</smart-list-item>
        <smart-list-item value="Netherlands">Netherlands</smart-list-item>
        <smart-list-item value="Netherlands Antilles">Netherlands Antilles</smart-list-item>
        <smart-list-item value="New Caledonia">New Caledonia</smart-list-item>
        <smart-list-item value="New Zealand">New Zealand</smart-list-item>
        <smart-list-item value="Nicaragua">Nicaragua</smart-list-item>
        <smart-list-item value="Niger">Niger</smart-list-item>
        <smart-list-item value="Nigeria">Nigeria</smart-list-item>
        <smart-list-item value="Niue">Niue</smart-list-item>
        <smart-list-item value="Norfolk Island">Norfolk Island</smart-list-item>
        <smart-list-item value="Northern Mariana Islands">Northern Mariana Islands</smart-list-item>
        <smart-list-item value="Norway">Norway</smart-list-item>
        <smart-list-item value="Oman">Oman</smart-list-item>
        <smart-list-item value="Pakistan">Pakistan</smart-list-item>
        <smart-list-item value="Palau">Palau</smart-list-item>
        <smart-list-item value="Palestinian Territory, Occupied">Palestinian Territory, Occupied</smart-list-item>
        <smart-list-item value="Panama">Panama</smart-list-item>
        <smart-list-item value="Papua New Guinea">Papua New Guinea</smart-list-item>
        <smart-list-item value="Paraguay">Paraguay</smart-list-item>
        <smart-list-item value="Peru">Peru</smart-list-item>
        <smart-list-item value="Philippines">Philippines</smart-list-item>
        <smart-list-item value="Pitcairn">Pitcairn</smart-list-item>
        <smart-list-item value="Poland">Poland</smart-list-item>
        <smart-list-item value="Portugal">Portugal</smart-list-item>
        <smart-list-item value="Puerto Rico">Puerto Rico</smart-list-item>
        <smart-list-item value="Qatar">Qatar</smart-list-item>
        <smart-list-item value="Reunion">Reunion</smart-list-item>
        <smart-list-item value="Romania">Romania</smart-list-item>
        <smart-list-item value="Russian Federation">Russian Federation</smart-list-item>
        <smart-list-item value="Rwanda">Rwanda</smart-list-item>
        <smart-list-item value="Saint Helena">Saint Helena</smart-list-item>
        <smart-list-item value="Saint Kitts and Nevis">Saint Kitts and Nevis</smart-list-item>
        <smart-list-item value="Saint Lucia">Saint Lucia</smart-list-item>
        <smart-list-item value="Saint Pierre and Miquelon">Saint Pierre and Miquelon</smart-list-item>
        <smart-list-item value="Saint Vincent and The Grenadines">Saint Vincent and The Grenadines</smart-list-item>
        <smart-list-item value="Samoa">Samoa</smart-list-item>
        <smart-list-item value="San Marino">San Marino</smart-list-item>
        <smart-list-item value="Sao Tome and Principe">Sao Tome and Principe</smart-list-item>
        <smart-list-item value="Saudi Arabia">Saudi Arabia</smart-list-item>
        <smart-list-item value="Senegal">Senegal</smart-list-item>
        <smart-list-item value="Serbia and Montenegro">Serbia and Montenegro</smart-list-item>
        <smart-list-item value="Seychelles">Seychelles</smart-list-item>
        <smart-list-item value="Sierra Leone">Sierra Leone</smart-list-item>
        <smart-list-item value="Singapore">Singapore</smart-list-item>
        <smart-list-item value="Slovakia">Slovakia</smart-list-item>
        <smart-list-item value="Slovenia">Slovenia</smart-list-item>
        <smart-list-item value="Solomon Islands">Solomon Islands</smart-list-item>
        <smart-list-item value="Somalia">Somalia</smart-list-item>
        <smart-list-item value="South Africa">South Africa</smart-list-item>
        <smart-list-item value="South Georgia and The South Sandwich Islands">South Georgia</smart-list-item>
        <smart-list-item value="Spain">Spain</smart-list-item>
        <smart-list-item value="Sri Lanka">Sri Lanka</smart-list-item>
        <smart-list-item value="Sudan">Sudan</smart-list-item>
        <smart-list-item value="Suriname">Suriname</smart-list-item>
        <smart-list-item value="Svalbard and Jan Mayen">Svalbard and Jan Mayen</smart-list-item>
        <smart-list-item value="Swaziland">Swaziland</smart-list-item>
        <smart-list-item value="Sweden">Sweden</smart-list-item>
        <smart-list-item value="Switzerland">Switzerland</smart-list-item>
        <smart-list-item value="Syrian Arab Republic">Syrian Arab Republic</smart-list-item>
        <smart-list-item value="Taiwan, Province of China">Taiwan, Province of China</smart-list-item>
        <smart-list-item value="Tajikistan">Tajikistan</smart-list-item>
        <smart-list-item value="Tanzania, United Republic of">Tanzania, United Republic of</smart-list-item>
        <smart-list-item value="Thailand">Thailand</smart-list-item>
        <smart-list-item value="Timor-leste">Timor-leste</smart-list-item>
        <smart-list-item value="Togo">Togo</smart-list-item>
        <smart-list-item value="Tokelau">Tokelau</smart-list-item>
        <smart-list-item value="Tonga">Tonga</smart-list-item>
        <smart-list-item value="Trinidad and Tobago">Trinidad and Tobago</smart-list-item>
        <smart-list-item value="Tunisia">Tunisia</smart-list-item>
        <smart-list-item value="Turkey">Turkey</smart-list-item>
        <smart-list-item value="Turkmenistan">Turkmenistan</smart-list-item>
        <smart-list-item value="Turks and Caicos Islands">Turks and Caicos Islands</smart-list-item>
        <smart-list-item value="Tuvalu">Tuvalu</smart-list-item>
        <smart-list-item value="Uganda">Uganda</smart-list-item>
        <smart-list-item value="Ukraine">Ukraine</smart-list-item>
        <smart-list-item value="United Arab Emirates">United Arab Emirates</smart-list-item>
        <smart-list-item value="United Kingdom">United Kingdom</smart-list-item>
        <smart-list-item value="United States">United States</smart-list-item>
        <smart-list-item
          value="United States Minor Outlying Islands"
        >United States Minor Outlying Islands</smart-list-item>
        <smart-list-item value="Uruguay">Uruguay</smart-list-item>
        <smart-list-item value="Uzbekistan">Uzbekistan</smart-list-item>
        <smart-list-item value="Vanuatu">Vanuatu</smart-list-item>
        <smart-list-item value="Venezuela">Venezuela</smart-list-item>
        <smart-list-item value="Viet Nam">Viet Nam</smart-list-item>
        <smart-list-item value="Virgin Islands, British">Virgin Islands, British</smart-list-item>
        <smart-list-item value="Virgin Islands, U.S.">Virgin Islands, U.S.</smart-list-item>
        <smart-list-item value="Wallis and Futuna">Wallis and Futuna</smart-list-item>
        <smart-list-item value="Western Sahara">Western Sahara</smart-list-item>
        <smart-list-item value="Yemen">Yemen</smart-list-item>
        <smart-list-item value="Zambia">Zambia</smart-list-item>
        <smart-list-item value="Zimbabwe">Zimbabwe</smart-list-item>
      </smart-combo-box>
    </template> 
    
    <script>
    import "smart-webcomponents/source/modules/smart.combobox.js";
    import "smart-webcomponents/source/styles/smart.default.css";
    
    export default {
      name: "app"
    };
    </script>
    
    <style>
    smart-combo-box {
      width: 300px;
    }
    </style>
    		
    We can now use the smart-combo-box with Vue. Data binding and event handlers will just work right out of the box.
    We have bound the properties of the smart-combo-box to values in our Vue component.

Running the Vue application

Start the app with
npm run serve
and open localhost:8080 in your favorite web browser to see the output below:

Read more about using Smart UI for Vue: https://www.htmlelements.com/docs/vue/.