Migrating Selects from Semantic UI to Bootstrap

In this document we'll be using SUI for ng2-semantic-ui and Bootstrap for ng-bootstrap.

SUI <sui-select> elements translate to Bootstrap's <div ngbDropdown>. The APIs are rather different, and some concepts don't translate directly; the dropdown is a much simpler component.

SUI selects follow this structure:

<sui-select id="avSelectArc"
              class="selection"
              [(ngModel)]="selectedOption"
              [options]="options"
              labelField="name"
              (selectedOptionChange)="onOptionChange()"
              #select>
    <sui-select-option *ngFor="let option of select.options"
                       [value]="option">
</sui-select-option>

Bootstrap selects follow this structure instead:

<div id="avSelectArc" ngbDropdown >
    <button class="btn"
            ngbDropdownToggle
            [ngClass]="{ 'text-muted': ! selectedOption }">
        {{ selectedOption ? selectedOption.name : 'Select one' }}
    </button>
    <div ngbDropdownMenu >
        <button ngbDropdownItem
                *ngFor="let option of options"
                (click)="setSelectedOption(option.name)">
            {{ option.name }}
        </button>
    </div>
</div>

NOTES

    .dropdown-item {
        min-width: 19.85em;
    }
    .dropdown-toggle {
        min-width: 20em;
    }

Notice that the item's width should be about 0.15em smaller.

    <button class="btn" ngbDropdownToggle
        [ngClass]="{ 'text-muted': ! selectedOption }"
        [disabled]="options.length === 0">
        ...