Build your web apps using Smart UI
Smart.MultiSplitButton– configuration and usage
Overview
Smart.MultiSplitButton represents a combination between DropDownList and Buttons Group. You can have multiple buttons with different actions and a drop-down list opened by clicking on a drop-down button.
Getting Started with MultiSplitButton 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 MultiSplitButton
Smart UI for Web Components is distributed as smart-webcomponents NPM package
- Download and install the package.
npm install smart-webcomponents
- Once installed, import the MultiSplitButton module in your application.
<script type="module" src="node_modules/smart-webcomponents/source/modules/smart.multisplitbutton.js"></script>
-
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" />
- Add the MultiSplitButton tag to your Web Page
<smart-multi-split-button id="multisplitbutton"></smart-multi-split-button>
- Create the MultiSplitButton Component
<script type="module"> Smart('#multisplitbutton', class { get properties() { return { disabled: true } } }); </script>
Another option is to create the MultiSplitButton is by using the traditional Javascript way:
const multisplitbutton = document.createElement('smart-multi-split-button'); multisplitbutton.disabled = true; document.body.appendChild(multisplitbutton);
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 #multisplitbutton is the ID of a DIV tag.
import "../../source/modules/smart.multisplitbutton.js"; document.readyState === 'complete' ? init() : window.onload = init; function init() { const multisplitbutton = new Smart.MultiSplitButton('#multisplitbutton', { disabled: true }); }
- Open the page in your web server.
Create, Append, Remove, Get/Set Property, Invoke Method, Bind to Event
Create a new element:
const multisplitbutton = document.createElement('smart-multi-split-button');
Append it to the DOM:
document.body.appendChild(multisplitbutton);
Remove it from the DOM:
multisplitbutton.parentNode.removeChild(multisplitbutton);
Set a property:
multisplitbutton.propertyName = propertyValue;
Get a property value:
const propertyValue = multisplitbutton.propertyName;
Invoke a method:
multisplitbutton.methodName(argument1, argument2);
Add Event Listener:
const eventHandler = (event) => { // your code here. }; multisplitbutton.addEventListener(eventName, eventHandler);
Remove Event Listener:
multisplitbutton.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 MultiSplitButton 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-multisplitbutton
Navigate to the created project folder
cd smart-angular-multisplitbutton
Setup the MultiSplitButton
Smart UI for Angular is distributed as smart-webcomponents-angular NPM package
- Download and install the package.
npm install smart-webcomponents-angular
- 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" ]
If you want to use Bootstrap, Fluent or other themes available in the package, you need to add them after 'smart.default.css'. -
Example with Angular Standalone Components
app.component.html
<smart-multi-split-button #multisplitbutton [buttonsDataSource]="['1', '2', '3']"> <smart-list-item [value]="'Afghanistan'">Afghanistan</smart-list-item> <smart-list-item [selected]="true" [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-multi-split-button>
app.component.ts
import { Component, ViewChild, OnInit, AfterViewInit } from '@angular/core'; import { MultiSplitButtonComponent } from 'smart-webcomponents-angular/multisplitbutton'; import { CommonModule } from '@angular/common'; import { RouterOutlet } from '@angular/router'; import { MultiSplitButtonModule } from 'smart-webcomponents-angular/multisplitbutton'; @Component({ selector: 'app-root', standalone: true, imports: [CommonModule, MultiSplitButtonModule, RouterOutlet], templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent implements AfterViewInit, OnInit { @ViewChild('multisplitbutton', { read: MultiSplitButtonComponent, static: false }) multisplitbutton!: MultiSplitButtonComponent; ngOnInit(): void { // onInit code. } ngAfterViewInit(): void { // afterViewInit code. this.init(); } init(): void { // init code. } }
-
Example with Angular NGModule
app.component.html
<smart-multi-split-button #multisplitbutton [buttonsDataSource]="['1', '2', '3']"> <smart-list-item [value]="'Afghanistan'">Afghanistan</smart-list-item> <smart-list-item [selected]="true" [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-multi-split-button>
app.component.ts
import { Component, ViewChild, OnInit, AfterViewInit } from '@angular/core'; import { MultiSplitButtonComponent } from 'smart-webcomponents-angular/multisplitbutton'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent implements AfterViewInit, OnInit { @ViewChild('multisplitbutton', { read: MultiSplitButtonComponent, static: false }) multisplitbutton!: MultiSplitButtonComponent; 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 { MultiSplitButtonModule } from 'smart-webcomponents-angular/multisplitbutton'; import { AppComponent } from './app.component'; @NgModule({ declarations: [ AppComponent ], imports: [ BrowserModule, MultiSplitButtonModule ], bootstrap: [ AppComponent ] }) export class AppModule { }
Running the Angular application
After completing the steps required to render a MultiSplitButton, run the following command to display the output in your web browser
ng serveand 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 MultiSplitButton Component
Setup React Environment
The easiest way to start with React is to use NextJS Next.js is a full-stack React framework. It’s versatile and lets you create React apps of any size—from a mostly static blog to a complex dynamic application.
npx create-next-app my-app cd my-app npm run devor
yarn create next-app my-app cd my-app yarn run dev
Preparation
Setup the MultiSplitButton
Smart UI for React is distributed as smart-webcomponents-react package
- Download and install the package.
In your React Next.js project, run one of the following commands to install Smart UI MultiSplitButton for ReactWith NPM:
npm install smart-webcomponents-react
With Yarn:yarn add smart-webcomponents-react
- Once installed, import the React MultiSplitButton 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/client'; import { MultiSplitButton, ListItem, ListItemsGroup } from 'smart-webcomponents-react/multisplitbutton'; class App extends React.Component { componentDidMount() { } render() { return ( <div> <MultiSplitButton buttonsDataSource={['1', '2', '3']}> <ListItem value="Afghanistan">Afghanistan</ListItem> <ListItem selected value="Albania">Albania</ListItem> <ListItem value="Algeria">Algeria</ListItem> <ListItem value="American Samoa">American Samoa</ListItem> <ListItem value="Andorra">Andorra</ListItem> <ListItem value="Angola">Angola</ListItem> <ListItem value="Anguilla">Anguilla</ListItem> <ListItem value="Antarctica">Antarctica</ListItem> <ListItem value="Antigua and Barbuda">Antigua and Barbuda</ListItem> <ListItem value="Argentina">Argentina</ListItem> <ListItem value="Armenia">Armenia</ListItem> <ListItem value="Aruba">Aruba</ListItem> <ListItem value="Australia">Australia</ListItem> <ListItem value="Austria">Austria</ListItem> <ListItem value="Azerbaijan">Azerbaijan</ListItem> <ListItem value="Bahamas">Bahamas</ListItem> <ListItem value="Bahrain">Bahrain</ListItem> <ListItem value="Bangladesh">Bangladesh</ListItem> <ListItem value="Barbados">Barbados</ListItem> <ListItem value="Belarus">Belarus</ListItem> <ListItem value="Belgium">Belgium</ListItem> <ListItem value="Belize">Belize</ListItem> <ListItem value="Benin">Benin</ListItem> <ListItem value="Bermuda">Bermuda</ListItem> <ListItem value="Bhutan">Bhutan</ListItem> <ListItem value="Bolivia">Bolivia</ListItem> <ListItem value="Bosnia and Herzegovina">Bosnia and Herzegovina</ListItem> <ListItem value="Botswana">Botswana</ListItem> <ListItem value="Bouvet Island">Bouvet Island</ListItem> <ListItem value="Brazil">Brazil</ListItem> <ListItem value="British Indian Ocean Territory">British Indian Ocean Territory</ListItem> <ListItem value="Brunei Darussalam">Brunei Darussalam</ListItem> <ListItem value="Bulgaria">Bulgaria</ListItem> <ListItem value="Burkina Faso">Burkina Faso</ListItem> <ListItem value="Burundi">Burundi</ListItem> <ListItem value="Cambodia">Cambodia</ListItem> <ListItem value="Cameroon">Cameroon</ListItem> <ListItem value="Canada">Canada</ListItem> <ListItem value="Cape Verde">Cape Verde</ListItem> <ListItem value="Cayman Islands">Cayman Islands</ListItem> <ListItem value="Central African Republic">Central African Republic</ListItem> <ListItem value="Chad">Chad</ListItem> <ListItem value="Chile">Chile</ListItem> <ListItem value="China">China</ListItem> <ListItem value="Christmas Island">Christmas Island</ListItem> <ListItem value="Cocos (Keeling) Islands">Cocos Islands</ListItem> <ListItem value="Colombia">Colombia</ListItem> <ListItem value="Comoros">Comoros</ListItem> <ListItem value="Congo">Congo</ListItem> <ListItem value="Congo, The Democratic Republic of The">Congo</ListItem> <ListItem value="Cook Islands">Cook Islands</ListItem> <ListItem value="Costa Rica">Costa Rica</ListItem> <ListItem value="Cote D'ivoire">Cote D'ivoire</ListItem> <ListItem value="Croatia">Croatia</ListItem> <ListItem value="Cuba">Cuba</ListItem> <ListItem value="Cyprus">Cyprus</ListItem> <ListItem value="Czech Republic">Czech Republic</ListItem> <ListItem value="Denmark">Denmark</ListItem> <ListItem value="Djibouti">Djibouti</ListItem> <ListItem value="Dominica">Dominica</ListItem> <ListItem value="Dominican Republic">Dominican Republic</ListItem> <ListItem value="Ecuador">Ecuador</ListItem> <ListItem value="Egypt">Egypt</ListItem> <ListItem value="El Salvador">El Salvador</ListItem> <ListItem value="Equatorial Guinea">Equatorial Guinea</ListItem> <ListItem value="Eritrea">Eritrea</ListItem> <ListItem value="Estonia">Estonia</ListItem> <ListItem value="Ethiopia">Ethiopia</ListItem> <ListItem value="Falkland Islands (Malvinas)">Falkland Islands</ListItem> <ListItem value="Faroe Islands">Faroe Islands</ListItem> <ListItem value="Fiji">Fiji</ListItem> <ListItem value="Finland">Finland</ListItem> <ListItem value="France">France</ListItem> <ListItem value="French Guiana">French Guiana</ListItem> <ListItem value="French Polynesia">French Polynesia</ListItem> <ListItem value="French Southern Territories">French Southern Territories</ListItem> <ListItem value="Gabon">Gabon</ListItem> <ListItem value="Gambia">Gambia</ListItem> <ListItem value="Georgia">Georgia</ListItem> <ListItem value="Germany">Germany</ListItem> <ListItem value="Ghana">Ghana</ListItem> <ListItem value="Gibraltar">Gibraltar</ListItem> <ListItem value="Greece">Greece</ListItem> <ListItem value="Greenland">Greenland</ListItem> <ListItem value="Grenada">Grenada</ListItem> <ListItem value="Guadeloupe">Guadeloupe</ListItem> <ListItem value="Guam">Guam</ListItem> <ListItem value="Guatemala">Guatemala</ListItem> <ListItem value="Guinea">Guinea</ListItem> <ListItem value="Guinea-bissau">Guinea-bissau</ListItem> <ListItem value="Guyana">Guyana</ListItem> <ListItem value="Haiti">Haiti</ListItem> <ListItem value="Heard Island and Mcdonald Islands">Heard Island and Mcdonald Islands</ListItem> <ListItem value="Holy See (Vatican City State)">Holy See</ListItem> <ListItem value="Honduras">Honduras</ListItem> <ListItem value="Hong Kong">Hong Kong</ListItem> <ListItem value="Hungary">Hungary</ListItem> <ListItem value="Iceland">Iceland</ListItem> <ListItem value="India">India</ListItem> <ListItem value="Indonesia">Indonesia</ListItem> <ListItem value="Iran, Islamic Republic of">Iran</ListItem> <ListItem value="Iraq">Iraq</ListItem> <ListItem value="Ireland">Ireland</ListItem> <ListItem value="Israel">Israel</ListItem> <ListItem value="Italy">Italy</ListItem> <ListItem value="Jamaica">Jamaica</ListItem> <ListItem value="Japan">Japan</ListItem> <ListItem value="Jordan">Jordan</ListItem> <ListItem value="Kazakhstan">Kazakhstan</ListItem> <ListItem value="Kenya">Kenya</ListItem> <ListItem value="Kiribati">Kiribati</ListItem> <ListItem value="Korea, Democratic People's Republic of">Korea</ListItem> <ListItem value="Korea, Republic of">Korea, Republic of</ListItem> <ListItem value="Kuwait">Kuwait</ListItem> <ListItem value="Kyrgyzstan">Kyrgyzstan</ListItem> <ListItem value="Lao People's Democratic Republic">Lao People's Democratic Republic</ListItem> <ListItem value="Latvia">Latvia</ListItem> <ListItem value="Lebanon">Lebanon</ListItem> <ListItem value="Lesotho">Lesotho</ListItem> <ListItem value="Liberia">Liberia</ListItem> <ListItem value="Libyan Arab Jamahiriya">Libyan Arab Jamahiriya</ListItem> <ListItem value="Liechtenstein">Liechtenstein</ListItem> <ListItem value="Lithuania">Lithuania</ListItem> <ListItem value="Luxembourg">Luxembourg</ListItem> <ListItem value="Macao">Macao</ListItem> <ListItem value="Macedonia, The Former Yugoslav Republic of">Macedonia</ListItem> <ListItem value="Madagascar">Madagascar</ListItem> <ListItem value="Malawi">Malawi</ListItem> <ListItem value="Malaysia">Malaysia</ListItem> <ListItem value="Maldives">Maldives</ListItem> <ListItem value="Mali">Mali</ListItem> <ListItem value="Malta">Malta</ListItem> <ListItem value="Marshall Islands">Marshall Islands</ListItem> <ListItem value="Martinique">Martinique</ListItem> <ListItem value="Mauritania">Mauritania</ListItem> <ListItem value="Mauritius">Mauritius</ListItem> <ListItem value="Mayotte">Mayotte</ListItem> <ListItem value="Mexico">Mexico</ListItem> <ListItem value="Micronesia, Federated States of">Micronesia</ListItem> <ListItem value="Moldova, Republic of">Moldova, Republic of</ListItem> <ListItem value="Monaco">Monaco</ListItem> <ListItem value="Mongolia">Mongolia</ListItem> <ListItem value="Montserrat">Montserrat</ListItem> <ListItem value="Morocco">Morocco</ListItem> <ListItem value="Mozambique">Mozambique</ListItem> <ListItem value="Myanmar">Myanmar</ListItem> <ListItem value="Namibia">Namibia</ListItem> <ListItem value="Nauru">Nauru</ListItem> <ListItem value="Nepal">Nepal</ListItem> <ListItem value="Netherlands">Netherlands</ListItem> <ListItem value="Netherlands Antilles">Netherlands Antilles</ListItem> <ListItem value="New Caledonia">New Caledonia</ListItem> <ListItem value="New Zealand">New Zealand</ListItem> <ListItem value="Nicaragua">Nicaragua</ListItem> <ListItem value="Niger">Niger</ListItem> <ListItem value="Nigeria">Nigeria</ListItem> <ListItem value="Niue">Niue</ListItem> <ListItem value="Norfolk Island">Norfolk Island</ListItem> <ListItem value="Northern Mariana Islands">Northern Mariana Islands</ListItem> <ListItem value="Norway">Norway</ListItem> <ListItem value="Oman">Oman</ListItem> <ListItem value="Pakistan">Pakistan</ListItem> <ListItem value="Palau">Palau</ListItem> <ListItem value="Palestinian Territory, Occupied">Palestinian Territory, Occupied</ListItem> <ListItem value="Panama">Panama</ListItem> <ListItem value="Papua New Guinea">Papua New Guinea</ListItem> <ListItem value="Paraguay">Paraguay</ListItem> <ListItem value="Peru">Peru</ListItem> <ListItem value="Philippines">Philippines</ListItem> <ListItem value="Pitcairn">Pitcairn</ListItem> <ListItem value="Poland">Poland</ListItem> <ListItem value="Portugal">Portugal</ListItem> <ListItem value="Puerto Rico">Puerto Rico</ListItem> <ListItem value="Qatar">Qatar</ListItem> <ListItem value="Reunion">Reunion</ListItem> <ListItem value="Romania">Romania</ListItem> <ListItem value="Russian Federation">Russian Federation</ListItem> <ListItem value="Rwanda">Rwanda</ListItem> <ListItem value="Saint Helena">Saint Helena</ListItem> <ListItem value="Saint Kitts and Nevis">Saint Kitts and Nevis</ListItem> <ListItem value="Saint Lucia">Saint Lucia</ListItem> <ListItem value="Saint Pierre and Miquelon">Saint Pierre and Miquelon</ListItem> <ListItem value="Saint Vincent and The Grenadines">Saint Vincent and The Grenadines</ListItem> <ListItem value="Samoa">Samoa</ListItem> <ListItem value="San Marino">San Marino</ListItem> <ListItem value="Sao Tome and Principe">Sao Tome and Principe</ListItem> <ListItem value="Saudi Arabia">Saudi Arabia</ListItem> <ListItem value="Senegal">Senegal</ListItem> <ListItem value="Serbia and Montenegro">Serbia and Montenegro</ListItem> <ListItem value="Seychelles">Seychelles</ListItem> <ListItem value="Sierra Leone">Sierra Leone</ListItem> <ListItem value="Singapore">Singapore</ListItem> <ListItem value="Slovakia">Slovakia</ListItem> <ListItem value="Slovenia">Slovenia</ListItem> <ListItem value="Solomon Islands">Solomon Islands</ListItem> <ListItem value="Somalia">Somalia</ListItem> <ListItem value="South Africa">South Africa</ListItem> <ListItem value="South Georgia and The South Sandwich Islands">South Georgia</ListItem> <ListItem value="Spain">Spain</ListItem> <ListItem value="Sri Lanka">Sri Lanka</ListItem> <ListItem value="Sudan">Sudan</ListItem> <ListItem value="Suriname">Suriname</ListItem> <ListItem value="Svalbard and Jan Mayen">Svalbard and Jan Mayen</ListItem> <ListItem value="Swaziland">Swaziland</ListItem> <ListItem value="Sweden">Sweden</ListItem> <ListItem value="Switzerland">Switzerland</ListItem> <ListItem value="Syrian Arab Republic">Syrian Arab Republic</ListItem> <ListItem value="Taiwan, Province of China">Taiwan, Province of China</ListItem> <ListItem value="Tajikistan">Tajikistan</ListItem> <ListItem value="Tanzania, United Republic of">Tanzania, United Republic of</ListItem> <ListItem value="Thailand">Thailand</ListItem> <ListItem value="Timor-leste">Timor-leste</ListItem> <ListItem value="Togo">Togo</ListItem> <ListItem value="Tokelau">Tokelau</ListItem> <ListItem value="Tonga">Tonga</ListItem> <ListItem value="Trinidad and Tobago">Trinidad and Tobago</ListItem> <ListItem value="Tunisia">Tunisia</ListItem> <ListItem value="Turkey">Turkey</ListItem> <ListItem value="Turkmenistan">Turkmenistan</ListItem> <ListItem value="Turks and Caicos Islands">Turks and Caicos Islands</ListItem> <ListItem value="Tuvalu">Tuvalu</ListItem> <ListItem value="Uganda">Uganda</ListItem> <ListItem value="Ukraine">Ukraine</ListItem> <ListItem value="United Arab Emirates">United Arab Emirates</ListItem> <ListItem value="United Kingdom">United Kingdom</ListItem> <ListItem value="United States">United States</ListItem> <ListItem value="United States Minor Outlying Islands">United States Minor Outlying Islands</ListItem> <ListItem value="Uruguay">Uruguay</ListItem> <ListItem value="Uzbekistan">Uzbekistan</ListItem> <ListItem value="Vanuatu">Vanuatu</ListItem> <ListItem value="Venezuela">Venezuela</ListItem> <ListItem value="Viet Nam">Viet Nam</ListItem> <ListItem value="Virgin Islands, British">Virgin Islands, British</ListItem> <ListItem value="Virgin Islands, U.S.">Virgin Islands, U.S.</ListItem> <ListItem value="Wallis and Futuna">Wallis and Futuna</ListItem> <ListItem value="Western Sahara">Western Sahara</ListItem> <ListItem value="Yemen">Yemen</ListItem> <ListItem value="Zambia">Zambia</ListItem> <ListItem value="Zimbabwe">Zimbabwe</ListItem> </MultiSplitButton> </div> ); } } export default App;
Running the React application
Start the app withnpm run devor
yarn run devand open localhost:3000 in your favorite web browser to see the output.
Setup with Vite
Vite (French word for "quick", pronounced /vit/, like "veet") is a build tool that aims to provide a faster and leaner development experience for modern web projectsWith NPM:
npm create vite@latestWith Yarn:
yarn create viteThen follow the prompts and choose React as a project.
Navigate to your project's directory. By default it is 'vite-project' and install Smart UI for React
In your Vite project, run one of the following commands to install Smart UI MultiSplitButton for ReactWith NPM:
npm install smart-webcomponents-reactWith Yarn:
yarn add smart-webcomponents-reactOpen src/App.tsx App.tsx
import 'smart-webcomponents-react/source/styles/smart.default.css'; import React from "react"; import ReactDOM from 'react-dom/client'; import { MultiSplitButton, ListItem, ListItemsGroup } from 'smart-webcomponents-react/multisplitbutton'; class App extends React.Component { componentDidMount() { } render() { return ( <div> <MultiSplitButton buttonsDataSource={['1', '2', '3']}> <ListItem value="Afghanistan">Afghanistan</ListItem> <ListItem selected value="Albania">Albania</ListItem> <ListItem value="Algeria">Algeria</ListItem> <ListItem value="American Samoa">American Samoa</ListItem> <ListItem value="Andorra">Andorra</ListItem> <ListItem value="Angola">Angola</ListItem> <ListItem value="Anguilla">Anguilla</ListItem> <ListItem value="Antarctica">Antarctica</ListItem> <ListItem value="Antigua and Barbuda">Antigua and Barbuda</ListItem> <ListItem value="Argentina">Argentina</ListItem> <ListItem value="Armenia">Armenia</ListItem> <ListItem value="Aruba">Aruba</ListItem> <ListItem value="Australia">Australia</ListItem> <ListItem value="Austria">Austria</ListItem> <ListItem value="Azerbaijan">Azerbaijan</ListItem> <ListItem value="Bahamas">Bahamas</ListItem> <ListItem value="Bahrain">Bahrain</ListItem> <ListItem value="Bangladesh">Bangladesh</ListItem> <ListItem value="Barbados">Barbados</ListItem> <ListItem value="Belarus">Belarus</ListItem> <ListItem value="Belgium">Belgium</ListItem> <ListItem value="Belize">Belize</ListItem> <ListItem value="Benin">Benin</ListItem> <ListItem value="Bermuda">Bermuda</ListItem> <ListItem value="Bhutan">Bhutan</ListItem> <ListItem value="Bolivia">Bolivia</ListItem> <ListItem value="Bosnia and Herzegovina">Bosnia and Herzegovina</ListItem> <ListItem value="Botswana">Botswana</ListItem> <ListItem value="Bouvet Island">Bouvet Island</ListItem> <ListItem value="Brazil">Brazil</ListItem> <ListItem value="British Indian Ocean Territory">British Indian Ocean Territory</ListItem> <ListItem value="Brunei Darussalam">Brunei Darussalam</ListItem> <ListItem value="Bulgaria">Bulgaria</ListItem> <ListItem value="Burkina Faso">Burkina Faso</ListItem> <ListItem value="Burundi">Burundi</ListItem> <ListItem value="Cambodia">Cambodia</ListItem> <ListItem value="Cameroon">Cameroon</ListItem> <ListItem value="Canada">Canada</ListItem> <ListItem value="Cape Verde">Cape Verde</ListItem> <ListItem value="Cayman Islands">Cayman Islands</ListItem> <ListItem value="Central African Republic">Central African Republic</ListItem> <ListItem value="Chad">Chad</ListItem> <ListItem value="Chile">Chile</ListItem> <ListItem value="China">China</ListItem> <ListItem value="Christmas Island">Christmas Island</ListItem> <ListItem value="Cocos (Keeling) Islands">Cocos Islands</ListItem> <ListItem value="Colombia">Colombia</ListItem> <ListItem value="Comoros">Comoros</ListItem> <ListItem value="Congo">Congo</ListItem> <ListItem value="Congo, The Democratic Republic of The">Congo</ListItem> <ListItem value="Cook Islands">Cook Islands</ListItem> <ListItem value="Costa Rica">Costa Rica</ListItem> <ListItem value="Cote D'ivoire">Cote D'ivoire</ListItem> <ListItem value="Croatia">Croatia</ListItem> <ListItem value="Cuba">Cuba</ListItem> <ListItem value="Cyprus">Cyprus</ListItem> <ListItem value="Czech Republic">Czech Republic</ListItem> <ListItem value="Denmark">Denmark</ListItem> <ListItem value="Djibouti">Djibouti</ListItem> <ListItem value="Dominica">Dominica</ListItem> <ListItem value="Dominican Republic">Dominican Republic</ListItem> <ListItem value="Ecuador">Ecuador</ListItem> <ListItem value="Egypt">Egypt</ListItem> <ListItem value="El Salvador">El Salvador</ListItem> <ListItem value="Equatorial Guinea">Equatorial Guinea</ListItem> <ListItem value="Eritrea">Eritrea</ListItem> <ListItem value="Estonia">Estonia</ListItem> <ListItem value="Ethiopia">Ethiopia</ListItem> <ListItem value="Falkland Islands (Malvinas)">Falkland Islands</ListItem> <ListItem value="Faroe Islands">Faroe Islands</ListItem> <ListItem value="Fiji">Fiji</ListItem> <ListItem value="Finland">Finland</ListItem> <ListItem value="France">France</ListItem> <ListItem value="French Guiana">French Guiana</ListItem> <ListItem value="French Polynesia">French Polynesia</ListItem> <ListItem value="French Southern Territories">French Southern Territories</ListItem> <ListItem value="Gabon">Gabon</ListItem> <ListItem value="Gambia">Gambia</ListItem> <ListItem value="Georgia">Georgia</ListItem> <ListItem value="Germany">Germany</ListItem> <ListItem value="Ghana">Ghana</ListItem> <ListItem value="Gibraltar">Gibraltar</ListItem> <ListItem value="Greece">Greece</ListItem> <ListItem value="Greenland">Greenland</ListItem> <ListItem value="Grenada">Grenada</ListItem> <ListItem value="Guadeloupe">Guadeloupe</ListItem> <ListItem value="Guam">Guam</ListItem> <ListItem value="Guatemala">Guatemala</ListItem> <ListItem value="Guinea">Guinea</ListItem> <ListItem value="Guinea-bissau">Guinea-bissau</ListItem> <ListItem value="Guyana">Guyana</ListItem> <ListItem value="Haiti">Haiti</ListItem> <ListItem value="Heard Island and Mcdonald Islands">Heard Island and Mcdonald Islands</ListItem> <ListItem value="Holy See (Vatican City State)">Holy See</ListItem> <ListItem value="Honduras">Honduras</ListItem> <ListItem value="Hong Kong">Hong Kong</ListItem> <ListItem value="Hungary">Hungary</ListItem> <ListItem value="Iceland">Iceland</ListItem> <ListItem value="India">India</ListItem> <ListItem value="Indonesia">Indonesia</ListItem> <ListItem value="Iran, Islamic Republic of">Iran</ListItem> <ListItem value="Iraq">Iraq</ListItem> <ListItem value="Ireland">Ireland</ListItem> <ListItem value="Israel">Israel</ListItem> <ListItem value="Italy">Italy</ListItem> <ListItem value="Jamaica">Jamaica</ListItem> <ListItem value="Japan">Japan</ListItem> <ListItem value="Jordan">Jordan</ListItem> <ListItem value="Kazakhstan">Kazakhstan</ListItem> <ListItem value="Kenya">Kenya</ListItem> <ListItem value="Kiribati">Kiribati</ListItem> <ListItem value="Korea, Democratic People's Republic of">Korea</ListItem> <ListItem value="Korea, Republic of">Korea, Republic of</ListItem> <ListItem value="Kuwait">Kuwait</ListItem> <ListItem value="Kyrgyzstan">Kyrgyzstan</ListItem> <ListItem value="Lao People's Democratic Republic">Lao People's Democratic Republic</ListItem> <ListItem value="Latvia">Latvia</ListItem> <ListItem value="Lebanon">Lebanon</ListItem> <ListItem value="Lesotho">Lesotho</ListItem> <ListItem value="Liberia">Liberia</ListItem> <ListItem value="Libyan Arab Jamahiriya">Libyan Arab Jamahiriya</ListItem> <ListItem value="Liechtenstein">Liechtenstein</ListItem> <ListItem value="Lithuania">Lithuania</ListItem> <ListItem value="Luxembourg">Luxembourg</ListItem> <ListItem value="Macao">Macao</ListItem> <ListItem value="Macedonia, The Former Yugoslav Republic of">Macedonia</ListItem> <ListItem value="Madagascar">Madagascar</ListItem> <ListItem value="Malawi">Malawi</ListItem> <ListItem value="Malaysia">Malaysia</ListItem> <ListItem value="Maldives">Maldives</ListItem> <ListItem value="Mali">Mali</ListItem> <ListItem value="Malta">Malta</ListItem> <ListItem value="Marshall Islands">Marshall Islands</ListItem> <ListItem value="Martinique">Martinique</ListItem> <ListItem value="Mauritania">Mauritania</ListItem> <ListItem value="Mauritius">Mauritius</ListItem> <ListItem value="Mayotte">Mayotte</ListItem> <ListItem value="Mexico">Mexico</ListItem> <ListItem value="Micronesia, Federated States of">Micronesia</ListItem> <ListItem value="Moldova, Republic of">Moldova, Republic of</ListItem> <ListItem value="Monaco">Monaco</ListItem> <ListItem value="Mongolia">Mongolia</ListItem> <ListItem value="Montserrat">Montserrat</ListItem> <ListItem value="Morocco">Morocco</ListItem> <ListItem value="Mozambique">Mozambique</ListItem> <ListItem value="Myanmar">Myanmar</ListItem> <ListItem value="Namibia">Namibia</ListItem> <ListItem value="Nauru">Nauru</ListItem> <ListItem value="Nepal">Nepal</ListItem> <ListItem value="Netherlands">Netherlands</ListItem> <ListItem value="Netherlands Antilles">Netherlands Antilles</ListItem> <ListItem value="New Caledonia">New Caledonia</ListItem> <ListItem value="New Zealand">New Zealand</ListItem> <ListItem value="Nicaragua">Nicaragua</ListItem> <ListItem value="Niger">Niger</ListItem> <ListItem value="Nigeria">Nigeria</ListItem> <ListItem value="Niue">Niue</ListItem> <ListItem value="Norfolk Island">Norfolk Island</ListItem> <ListItem value="Northern Mariana Islands">Northern Mariana Islands</ListItem> <ListItem value="Norway">Norway</ListItem> <ListItem value="Oman">Oman</ListItem> <ListItem value="Pakistan">Pakistan</ListItem> <ListItem value="Palau">Palau</ListItem> <ListItem value="Palestinian Territory, Occupied">Palestinian Territory, Occupied</ListItem> <ListItem value="Panama">Panama</ListItem> <ListItem value="Papua New Guinea">Papua New Guinea</ListItem> <ListItem value="Paraguay">Paraguay</ListItem> <ListItem value="Peru">Peru</ListItem> <ListItem value="Philippines">Philippines</ListItem> <ListItem value="Pitcairn">Pitcairn</ListItem> <ListItem value="Poland">Poland</ListItem> <ListItem value="Portugal">Portugal</ListItem> <ListItem value="Puerto Rico">Puerto Rico</ListItem> <ListItem value="Qatar">Qatar</ListItem> <ListItem value="Reunion">Reunion</ListItem> <ListItem value="Romania">Romania</ListItem> <ListItem value="Russian Federation">Russian Federation</ListItem> <ListItem value="Rwanda">Rwanda</ListItem> <ListItem value="Saint Helena">Saint Helena</ListItem> <ListItem value="Saint Kitts and Nevis">Saint Kitts and Nevis</ListItem> <ListItem value="Saint Lucia">Saint Lucia</ListItem> <ListItem value="Saint Pierre and Miquelon">Saint Pierre and Miquelon</ListItem> <ListItem value="Saint Vincent and The Grenadines">Saint Vincent and The Grenadines</ListItem> <ListItem value="Samoa">Samoa</ListItem> <ListItem value="San Marino">San Marino</ListItem> <ListItem value="Sao Tome and Principe">Sao Tome and Principe</ListItem> <ListItem value="Saudi Arabia">Saudi Arabia</ListItem> <ListItem value="Senegal">Senegal</ListItem> <ListItem value="Serbia and Montenegro">Serbia and Montenegro</ListItem> <ListItem value="Seychelles">Seychelles</ListItem> <ListItem value="Sierra Leone">Sierra Leone</ListItem> <ListItem value="Singapore">Singapore</ListItem> <ListItem value="Slovakia">Slovakia</ListItem> <ListItem value="Slovenia">Slovenia</ListItem> <ListItem value="Solomon Islands">Solomon Islands</ListItem> <ListItem value="Somalia">Somalia</ListItem> <ListItem value="South Africa">South Africa</ListItem> <ListItem value="South Georgia and The South Sandwich Islands">South Georgia</ListItem> <ListItem value="Spain">Spain</ListItem> <ListItem value="Sri Lanka">Sri Lanka</ListItem> <ListItem value="Sudan">Sudan</ListItem> <ListItem value="Suriname">Suriname</ListItem> <ListItem value="Svalbard and Jan Mayen">Svalbard and Jan Mayen</ListItem> <ListItem value="Swaziland">Swaziland</ListItem> <ListItem value="Sweden">Sweden</ListItem> <ListItem value="Switzerland">Switzerland</ListItem> <ListItem value="Syrian Arab Republic">Syrian Arab Republic</ListItem> <ListItem value="Taiwan, Province of China">Taiwan, Province of China</ListItem> <ListItem value="Tajikistan">Tajikistan</ListItem> <ListItem value="Tanzania, United Republic of">Tanzania, United Republic of</ListItem> <ListItem value="Thailand">Thailand</ListItem> <ListItem value="Timor-leste">Timor-leste</ListItem> <ListItem value="Togo">Togo</ListItem> <ListItem value="Tokelau">Tokelau</ListItem> <ListItem value="Tonga">Tonga</ListItem> <ListItem value="Trinidad and Tobago">Trinidad and Tobago</ListItem> <ListItem value="Tunisia">Tunisia</ListItem> <ListItem value="Turkey">Turkey</ListItem> <ListItem value="Turkmenistan">Turkmenistan</ListItem> <ListItem value="Turks and Caicos Islands">Turks and Caicos Islands</ListItem> <ListItem value="Tuvalu">Tuvalu</ListItem> <ListItem value="Uganda">Uganda</ListItem> <ListItem value="Ukraine">Ukraine</ListItem> <ListItem value="United Arab Emirates">United Arab Emirates</ListItem> <ListItem value="United Kingdom">United Kingdom</ListItem> <ListItem value="United States">United States</ListItem> <ListItem value="United States Minor Outlying Islands">United States Minor Outlying Islands</ListItem> <ListItem value="Uruguay">Uruguay</ListItem> <ListItem value="Uzbekistan">Uzbekistan</ListItem> <ListItem value="Vanuatu">Vanuatu</ListItem> <ListItem value="Venezuela">Venezuela</ListItem> <ListItem value="Viet Nam">Viet Nam</ListItem> <ListItem value="Virgin Islands, British">Virgin Islands, British</ListItem> <ListItem value="Virgin Islands, U.S.">Virgin Islands, U.S.</ListItem> <ListItem value="Wallis and Futuna">Wallis and Futuna</ListItem> <ListItem value="Western Sahara">Western Sahara</ListItem> <ListItem value="Yemen">Yemen</ListItem> <ListItem value="Zambia">Zambia</ListItem> <ListItem value="Zimbabwe">Zimbabwe</ListItem> </MultiSplitButton> </div> ); } } export default App;
Read more about using Smart UI for React: https://www.htmlelements.com/docs/react/.
Getting Started with Vue MultiSplitButton Component
Setup Vue with Vite
In this section we will introduce how to scaffold a Vue Single Page Application on your local machine. The created project will be using a build setup based on Vite and allow us to use Vue Single-File Components (SFCs). Run the following command in your command linenpm create vue@latestThis command will install and execute create-vue, the official Vue project scaffolding tool. You will be presented with prompts for several optional features such as TypeScript and testing support:
✔ Project name: …If you are unsure about an option, simply choose No by hitting enter for now. Once the project is created, follow the instructions to install dependencies and start the dev server:✔ Add TypeScript? … No / Yes ✔ Add JSX Support? … No / Yes ✔ Add Vue Router for Single Page Application development? … No / Yes ✔ Add Pinia for state management? … No / Yes ✔ Add Vitest for Unit testing? … No / Yes ✔ Add an End-to-End Testing Solution? … No / Cypress / Playwright ✔ Add ESLint for code quality? … No / Yes ✔ Add Prettier for code formatting? … No / Yes Scaffolding project in ./ ... Done.
cdnpm install npm install smart-webcomponents npm run dev
-
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 vite.config.js in your favorite text editor and change its contents to the following:
vite.config.js
import { fileURLToPath, URL } from 'node:url' import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' // https://vitejs.dev/config/ export default defineConfig({ plugins: [ vue({ template: { compilerOptions: { isCustomElement: tag => tag.startsWith('smart-') } } }) ], resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url)) } } })
-
Open src/App.vue in your favorite text editor and change its contents to the following:
App.vue
<template> <div class="vue-root"> <smart-multi-split-button buttons-data-source="['1', '2', '3']"> <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-multi-split-button> </div> </template> <script> import { onMounted } from "vue"; import "smart-webcomponents/source/styles/smart.default.css"; import "smart-webcomponents/source/modules/smart.multisplitbutton.js"; export default { name: "app", setup() { onMounted(() => {}); } }; </script> <style> smart-multi-split-button { min-height: 35px; height: auto; width: 300px; } </style>
We can now use the smart-multi-split-button with Vue 3. Data binding and event handlers will just work right out of the box.
Running the Vue application
Start the app withnpm run devand open http://localhost:5173/ in your favorite web browser to see the output below:
When you are ready to ship your app to production, run the following:
npm run buildThis will create a production-ready build of your app in the project's ./dist directory.
Read more about using Smart UI for Vue: https://www.htmlelements.com/docs/vue/.