smt-select ๐Ÿ‘†

February 10, 2026 ยท View on GitHub

A high-performance, lightweight, and customizable Angular Select Component with built-in Virtual Scroll and Search capabilities.

โœจ Features

  • ๐Ÿ” Searchable: Quickly filter through thousands of options.
  • โšก Virtual Scroll: Built-in support for high-performance rendering of large datasets.
  • โœ… Multi-Select: Support for multiple selection out of the box.
  • โ˜‘๏ธ Select All: Optional "Select All" toggle for multi-select mode.
  • โŒจ๏ธ Keyboard Navigation: Full keyboard support (Arrow keys, Enter, Escape).
  • ๐Ÿšซ Disabled Options: Mark options as non-selectable.
  • โŒ Clearable: Optional clear button to reset selection.
  • ๐ŸŽจ Custom Styling: Fully customizable via SCSS tokens.
  • ๐Ÿ“ฑ Responsive: Works seamlessly across mobile and desktop.
  • ๐Ÿ›ก๏ธ Type Safe: Developed with strict TypeScript.

๐Ÿ“บ Demo

smt-select demo


๐Ÿงฉ Angular Compatibility

Angular VersionSupport
21.xโœ… Yes
20.xโœ… Yes
19.xโœ… Yes
18.xโœ… Yes

๐Ÿš€ Installation

npm install smt-select

Note: Angular CDK is a peer dependency and will be automatically installed by npm 7+. Make sure it matches your Angular version.

๐Ÿ’ก Manual CDK Installation (if needed)

If you're using npm 6 or need a specific CDK version:

# Install CDK first (version should match your Angular version)
npm install @angular/cdk@^21.0.0

# Then install smt-select
npm install smt-select

๐Ÿ“ฆ Usage

1. Component Logic (app.component.ts)

import { SmtSelectComponent, SmtSelectOption, SmtSelectConfig } from 'smt-select';

@Component({
  standalone: true,
  imports: [SmtSelectComponent],
  selector: 'app-root',
  templateUrl: './app.component.html'
})
export class AppComponent {
  myOptions: SmtSelectOption[] = [
    { value: 1, label: 'Option 1' },
    { value: 2, label: 'Option 2', disabled: true }, // Disabled option
    { value: 3, label: 'Option 3' }
  ];

  selectConfig: SmtSelectConfig = {
    placeholder: 'Choose an item...',
    virtualScroll: true,
    isMultiSelect: false,
    clearable: true, // Enable clear button
    noResultsMessage: 'No items found' // Custom no results message
  };

  // Multi-select configuration with Select All
  multiSelectConfig: SmtSelectConfig = {
    placeholder: 'Choose multiple items...',
    virtualScroll: true,
    isMultiSelect: true,
    showSelectAll: true, // Enable Select All option
    clearable: true
  };

  selectedValue: any = null;

  onSelection(value: any) {
    console.log('Selected value:', value);
  }
}

2. Template (app.component.html)

<smt-select
  [options]="myOptions"
  [config]="selectConfig"
  [(selectedValue)]="selectedValue"
  (selectionChange)="onSelection($event)">
</smt-select>

๐ŸŽจ Customization

You can customize the component's appearance by providing custom colors:

selectConfig: SmtSelectConfig = {
  placeholder: 'Choose an item...',
  virtualScroll: true,
  isMultiSelect: false,
  // Custom theme colors
  optionActiveBackgroundColor: '#ff6b6b',
  optionActiveTextColor: '#ffffff',
  hoverBackgroundColor: '#ffe0e0',
  optionTextColor: '#333333',
  optionBackgroundColor: 'transparent',
  inputTextColor: '#000000', // Placeholder automatically uses 60% opacity
  borderColor: '#cccccc',
  errorBorderColor: '#d9534f',
  borderRadius: 8 // Can be number (px) or string ('8px', '0.5rem')
};

โš™๏ธ API Reference

Inputs

PropertyTypeDefaultDescription
optionsSmtSelectOption[][]Array of options to display.
configSmtSelectConfig{}Configuration object for the component.
selectedValueany | any[]nullThe currently selected value(s). Supports two-way binding.
errorMessagestring | nullundefinedError message to display below the component.
isInvalidbooleanfalseManually trigger error state if errorMessage is not provided.
visibilitySmtVisibilityTypeENABLEDControls accessibility (ENABLED, READONLY, HIDDEN).

Outputs

EventPayloadDescription
selectionChangeany | any[]Fired when the selected value changes.
selectedValueChangeany | any[]Fired when the selected value changes (for two-way binding support).
pocketOpenbooleanFired when the dropdown is opened or closed.

Option Structure (SmtSelectOption)

PropertyTypeRequiredDescription
valueanyYesThe value of the option.
labelstringYesDisplay text for the option.
disabledbooleanNoMark option as non-selectable (default: false).

Configuration (SmtSelectConfig)

PropertyTypeDescription
fieldIDstring | numberUnique ID for the wrapper element.
placeholderstringText to show when no value is selected.
virtualScrollbooleanEnable/Disable CDK Virtual Scroll for large datasets.
isMultiSelectbooleanEnable multiple item selection.
clearablebooleanShow clear button to reset selection (default: false).
showSelectAllbooleanShow "Select All" option in multi-select mode (default: false). Only visible when isMultiSelect is true.
noResultsMessagestringCustom message when no results found (default: 'No results found').
Theme Colors
optionActiveBackgroundColorstringBackground color for selected options (default: #005f87).
optionActiveTextColorstringText color for selected options (default: #fff).
hoverBackgroundColorstringBackground color for hovered items (default: #f0faff).
optionTextColorstringText color for normal options (default: #333).
optionBackgroundColorstringBackground color for normal options (default: transparent).
inputTextColorstringText color for search input, selected value, and placeholder (with 60% opacity) (default: #333).
borderColorstringBorder color for the component and dropdown (default: #ccc).
errorBorderColorstringBorder color when in error state (default: #d9534f).
borderRadiusstring | numberBorder radius for the component and dropdown. Number will be converted to px (default: 4px).

โŒจ๏ธ Keyboard Shortcuts

When the dropdown is open:

  • Arrow Down / Arrow Up: Navigate through options
  • Enter: Select highlighted option
  • Escape: Close dropdown
  • Type to search: Filter options in real-time

๐Ÿ“„ License

MIT ยฉ Samet Acar