You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP โ†’
Socket
Book a DemoInstallSign in
Socket

seo-select

Package Overview
Dependencies
Maintainers
0
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

seo-select

A customizable and accessible select component with search functionality built with Lit

1.0.14
latest
Source
npmnpm
Version published
Weekly downloads
1K
Maintainers
0
Weekly downloads
ย 
Created
Source

seo-select

logo

A highly customizable and accessible select component with search functionality built with Lit. Supports virtual scrolling, multiple selection, internationalization, and modern theming.

Demo Site: https://seo-select.netlify.app/

Features

  • ๐ŸŽจ Multiple Themes: Basic, float themes with dark mode support
  • ๐ŸŒ Internationalization: Built-in support for multiple languages (EN, KO, JA, ZH)
  • ๐Ÿ” Search Functionality: Advanced multilingual search with fuzzy matching
  • โ™ฟ Accessibility: Full keyboard navigation and screen reader support
  • ๐Ÿš€ Virtual Scrolling: High performance with large datasets
  • ๐Ÿ“ Auto Width: Automatic width calculation based on content
  • ๐ŸŽฏ Multiple Selection: Tag-based multi-select with individual remove buttons
  • ๐Ÿ’ก TypeScript: Full TypeScript support with comprehensive type definitions

Installation

npm install seo-select

Import Methods

// Import basic select component
import 'seo-select';

// Import search-enabled select component
import 'seo-select/components/seo-select-search';

// Import both components
import 'seo-select';
import 'seo-select/components/seo-select-search';

Components Overview

seo-select - Basic Select Component

The foundational select component with essential features:

  • Standard dropdown functionality
  • Virtual scrolling for large datasets
  • Multiple selection support
  • Theme and dark mode support
  • Form integration
  • Keyboard navigation

seo-select-search - Search-Enhanced Select Component

Extended component with advanced search capabilities:

  • All features of seo-select
  • Real-time multilingual search
  • Korean initial consonant search (ใ…Žใ„ฑใ…‡ โ†’ ํ•œ๊ตญ์–ด)
  • Japanese romaji search (nihongo โ†’ ๆ—ฅๆœฌ่ชž)
  • Chinese pinyin search (beijing โ†’ ๅŒ—ไบฌ)
  • Fuzzy matching across languages

Use Cases & When to Use Each Component

Use seo-select when:

โœ… Small to Medium Option Lists (< 50 items)

<seo-select name="priority" width="150px">
  <option value="low">Low</option>
  <option value="medium">Medium</option>
  <option value="high">High</option>
  <option value="urgent">Urgent</option>
</seo-select>

โœ… Form Controls with Known Options

<seo-select name="country" required>
  <option value="">Select Country</option>
  <option value="us">United States</option>
  <option value="kr">South Korea</option>
  <option value="jp">Japan</option>
</seo-select>

โœ… Settings and Configuration Panels

<seo-select name="theme" theme="float" dark>
  <option value="auto">Auto</option>
  <option value="light">Light Mode</option>
  <option value="dark">Dark Mode</option>
</seo-select>

โœ… Multi-Select with Limited Options

<seo-select multiple name="permissions" width="300px">
  <option value="read">Read</option>
  <option value="write">Write</option>
  <option value="delete">Delete</option>
  <option value="admin">Admin</option>
</seo-select>

Use seo-select-search when:

โœ… Large Option Lists (50+ items)

<seo-select-search name="city" width="300px">
  <!-- Hundreds of cities -->
  <option value="seoul">Seoul (์„œ์šธ)</option>
  <option value="tokyo">Tokyo (ๆฑไบฌ)</option>
  <option value="beijing">Beijing (ๅŒ—ไบฌ)</option>
  <!-- ... hundreds more -->
</seo-select-search>

โœ… Multilingual Content

<seo-select-search name="product" language="ko" width="350px">
  <option value="phone">์Šค๋งˆํŠธํฐ (Smartphone)</option>
  <option value="laptop">๋…ธํŠธ๋ถ (Laptop)</option>
  <option value="tablet">ํƒœ๋ธ”๋ฆฟ (Tablet)</option>
</seo-select-search>

โœ… User-Friendly Data Entry

<!-- Users can type "js" or "javascript" to find JavaScript -->
<seo-select-search multiple name="skills" width="400px">
  <option value="javascript">JavaScript</option>
  <option value="typescript">TypeScript</option>
  <option value="python">Python</option>
  <option value="react">React</option>
</seo-select-search>

โœ… Dynamic Data Loading

<seo-select-search id="async-select" name="users" width="300px">
  <!-- Options loaded via API -->
</seo-select-search>

<script>
  // Load thousands of users from API
  fetch('/api/users')
    .then(response => response.json())
    .then(users => {
      document.getElementById('async-select').optionItems = users.map(user => ({
        value: user.id,
        label: `${user.name} (${user.email})`
      }));
    });
</script>

โœ… International Applications

<!-- Supports Korean initial consonants, Japanese romaji, Chinese pinyin -->
<seo-select-search name="location" language="en" width="300px">
  <option value="kr-seoul">์„œ์šธ, ๋Œ€ํ•œ๋ฏผ๊ตญ (Seoul, South Korea)</option>
  <option value="jp-tokyo">ๆฑไบฌ, ๆ—ฅๆœฌ (Tokyo, Japan)</option>
  <option value="cn-beijing">ๅŒ—ไบฌ, ไธญๅ›ฝ (Beijing, China)</option>
</seo-select-search>

Performance Guidelines

ScenarioComponentReason
< 20 optionsseo-selectMinimal overhead, faster rendering
20-50 optionsEitherPersonal preference, both perform well
50-1000 optionsseo-select-searchSearch reduces cognitive load
1000+ optionsseo-select-searchVirtual scrolling + search essential
Multilingualseo-select-searchAdvanced search algorithms needed
Form controlsseo-selectSimpler UI, standard behavior
Data explorationseo-select-searchSearch enhances discoverability

Basic Usage Examples

Simple Select

<!DOCTYPE html>
<html>
<head>
  <script type="module">
    import 'seo-select';
  </script>
</head>
<body>
  <seo-select name="country" required>
    <option value="us">United States</option>
    <option value="kr">South Korea</option>
    <option value="jp">Japan</option>
  </seo-select>
</body>
</html>

Search-enabled Select

<script type="module">
  import 'seo-select/components/seo-select-search';
</script>

<seo-select-search 
  name="city" 
  theme="float" 
  language="en"
  show-reset>
  <option value="seoul">Seoul</option>
  <option value="tokyo">Tokyo</option>
  <option value="beijing">Beijing</option>
</seo-select-search>

Multiple Selection

<seo-select-search 
  multiple 
  name="skills" 
  theme="float"
  show-reset>
  <option value="js">JavaScript</option>
  <option value="ts">TypeScript</option>
  <option value="python">Python</option>
</seo-select-search>

JavaScript/TypeScript Usage

import { SeoSelect, SeoSelectSearch } from 'seo-select';

// Create programmatically
const select = new SeoSelectSearch();
select.optionItems = [
  { value: 'option1', label: 'Option 1' },
  { value: 'option2', label: 'Option 2' }
];
select.multiple = true;
select.theme = 'float';
select.language = 'ko';

document.body.appendChild(select);

// Event handling
select.addEventListener('onSelect', (e) => {
  console.log('Selected:', e.detail);
});

select.addEventListener('onChange', (e) => {
  console.log('Value changed:', select.value);
});

Component Properties

Common Properties

PropertyTypeDefaultDescription
namestring-Form field name
requiredbooleanfalseWhether the field is required
multiplebooleanfalseEnable multiple selection
theme'basic' | 'float''float'Visual theme
darkbooleanfalseEnable dark mode
language'en' | 'ko' | 'ja' | 'zh''en'Interface language
showResetbooleantrueShow reset button
widthstringnullCustom width (auto-calculated if not set)
heightstring'100%'Component height

SeoSelectSearch Additional Properties

PropertyTypeDefaultDescription
searchTextsPartial<SearchLocalizedTexts>{}Custom search-related texts

Methods

SeoSelect

// Value management
select.value = 'option1';                    // Set single value
select.selectedValues = ['opt1', 'opt2'];    // Set multiple values (multiple mode)

// Language and customization
select.setLanguage('ko');                     // Change language
select.setTexts({ placeholder: 'Custom...' }); // Custom texts

// Options management
select.optionItems = newOptions;              // Set options programmatically

// Utility
select.resetToDefaultValue();                 // Reset to default

SeoSelectSearch

// Inherits all SeoSelect methods plus:
select.setSearchTexts({ 
  searchPlaceholder: 'Type to search...',
  noMatchText: 'No results found'
});

// Test search functionality (for debugging)
const matches = select.testMultilingualSearch('search', 'target');

Events

Event NameDetailDescription
onSelect{ value, label }Item selected
onDeselect{ value, label }Item deselected (multiple mode)
onChange-Value changed
onReset{ value, label } or { values, labels }Reset to default

Styling and Customization

The component comes with built-in themes, but you can extensively customize the appearance using CSS variables.

Quick Styling Example

seo-select {
  --select-border-color: #ccc;
  --select-focus-color: #007bff;
  --select-background: white;
  --select-text-color: #333;
}

/* Dark mode */
seo-select.dark {
  --select-background: #374151;
  --select-text-color: #f3f4f6;
  --select-border-color: #6b7280;
}

Complete CSS Variables Reference

๐Ÿ“ Layout & Sizing Variables
VariableDefault ValueDescription
--select-padding0.5rem 0.8remInternal padding of select box
--select-min-height2.5remMinimum height of select component
--select-border-width1pxBorder thickness
--select-multi-padding-right3remRight padding for multiple selection
--select-tags-gap0.25remGap between tags in multiple mode
--select-tags-padding0.25rem 0Padding around tags container
--select-tags-min-height1.5remMinimum height of tags area
๐ŸŽจ Theme & Visual Variables
VariableDefault ValueDescription
--select-transition-duration0.3sAnimation transition duration
--select-transition-easingeaseAnimation easing function
--select-basic-border-radius0Border radius for basic theme
--select-float-border-radius5pxBorder radius for float theme
--select-basic-box-shadownoneBox shadow for basic theme
--select-float-box-shadow0 2px 4px rgba(0, 0, 0, 0.1)Box shadow for float theme
๐Ÿท๏ธ Tags & Multiple Selection Variables
VariableDefault ValueDescription
--tag-padding0.2rem 0.3remInternal padding of tags
--tag-gap0.5remGap between individual tags
--tag-border-radius25remBorder radius of tags (pill shape)
--tag-border-width1pxBorder thickness of tags
--tag-font-size1.2remFont size within tags
--tag-remove-size1remSize of tag remove button
--tag-remove-border-radius50%Border radius of remove button
--tag-remove-transitionall 0.2s easeTransition for remove button
๐Ÿ“‹ Dropdown & Options Variables
VariableDefault ValueDescription
--dropdown-box-shadow0 5px 10px rgba(0, 0, 0, 0.1)Box shadow of dropdown
--dropdown-border-width1pxBorder thickness of dropdown
--dropdown-z-index1000Z-index stacking order
--dropdown-basic-border-radius0Border radius for basic theme dropdown
--dropdown-float-border-radius5pxBorder radius for float theme dropdown
--dropdown-float-box-shadow0 8px 16px rgba(0, 0, 0, 0.15)Enhanced shadow for float theme
--dropdown-float-top130%Dropdown position from select box
--option-padding0 0.8remInternal padding of option items
--option-line-height300%Line height of option items
--option-check-mark-margin0.5remMargin of checkmark in options
๐Ÿ” Search Input Variables
VariableDefault ValueDescription
--search-input-padding0.3remInternal padding of search input
--search-input-text-indent1.5remText indentation for search icon space
--search-icon-left0.7remLeft position of search icon
--search-icon-size1remSize of search icon
โณ Loading & Empty State Variables
VariableDefault ValueDescription
--loading-container-padding1rem 2remPadding around loading container
--loading-dots-gap0.5remGap between loading dots
--loading-dots-margin-bottom1remBottom margin of dots container
--loading-dot-size0.5remSize of individual loading dots
--loading-animation-duration1.4sDuration of loading animation
--loading-text-font-size0.9remFont size of loading text
--no-data-container-padding1rem 2remPadding of "no data" container
--no-data-text-font-size0.9remFont size of "no data" text
๐Ÿ”„ Reset Button & Controls Variables
VariableDefault ValueDescription
--reset-button-right3remRight position of reset button
--reset-button-padding0 0.5remInternal padding of reset button
--reset-button-height80%Height of reset button
--reset-button-font-size0.9remFont size of reset button
--reset-button-transitionall 0.2s easeTransition for reset button
--multi-reset-button-size1.5remSize of multi-select reset button
--multi-reset-button-position-0.6remPosition adjustment for multi reset
--multi-reset-button-border-radius50%Border radius of multi reset button
--arrow-right0.8remRight position of dropdown arrow
--arrow-font-size0.9remFont size of dropdown arrow
--arrow-transitiontransform 0.2s easeTransition for arrow rotation
๐ŸŒ™ Dark Mode Color Variables
VariableDefault ValueDescription
--dark-select-bg#374151Background color in dark mode
--dark-dropdown-bg#374151Dropdown background in dark mode
--dark-tag-bg#4b5563Tag background in dark mode
--dark-search-input-bg#374151Search input background in dark mode
--dark-border-color#6b7280Border color in dark mode
--dark-border-hover-color#60a5faBorder color on hover in dark mode
--dark-border-focus-color#60a5faBorder color on focus in dark mode
--dark-text-color#f3f4f6Primary text color in dark mode
--dark-text-secondary-color#d1d5dbSecondary text color in dark mode
--dark-placeholder-color#9ca3afPlaceholder color in dark mode
--dark-option-hover-bg#4b5563Option background on hover
--dark-option-selected-bg#3b82f6Selected option background
--dark-option-focused-bg#4b5563Focused option background
--dark-tag-text-color#f3f4f6Tag text color in dark mode
--dark-tag-border-color#60a5faTag border color in dark mode
--dark-tag-remove-hover-bg#ef4444Tag remove button hover background
--dark-reset-button-color#d1d5dbReset button color in dark mode
--dark-reset-button-hover-color#ef4444Reset button hover color

Advanced Customization Examples

/* Custom brand colors */
seo-select {
  --select-focus-color: #ff6b6b;
  --select-float-box-shadow: 0 4px 12px rgba(255, 107, 107, 0.15);
  --tag-border-color: #ff6b6b;
  --dropdown-float-box-shadow: 0 10px 25px rgba(255, 107, 107, 0.1);
}

/* Compact size variant */
seo-select.compact {
  --select-min-height: 2rem;
  --select-padding: 0.25rem 0.5rem;
  --tag-padding: 0.1rem 0.25rem;
  --tag-font-size: 0.875rem;
}

/* Large size variant */
seo-select.large {
  --select-min-height: 3.5rem;
  --select-padding: 0.75rem 1rem;
  --tag-padding: 0.375rem 0.5rem;
  --tag-font-size: 1rem;
}

/* Custom dark theme */
seo-select[dark] {
  --dark-select-bg: #1a1a1a;
  --dark-text-color: #ffffff;
  --dark-border-color: #333333;
  --dark-option-hover-bg: #2a2a2a;
}

Framework Integration Examples

React Integration

import { useEffect, useRef } from 'react';
import { SeoSelect, SeoSelectSearch } from 'seo-select';

function MyComponent() {
  const selectRef = useRef(null);

  useEffect(() => {
    const select = new SeoSelectSearch();
    select.optionItems = [
      { value: 'react', label: 'React' },
      { value: 'vue', label: 'Vue' },
      { value: 'angular', label: 'Angular' }
    ];
    select.multiple = true;
    select.theme = 'float';
    
    const container = selectRef.current;
    container.appendChild(select);

    const handleSelect = (e) => {
      console.log('Selected:', e.detail);
    };

    select.addEventListener('seo-select:select', handleSelect);

    return () => {
      select.removeEventListener('seo-select:select', handleSelect);
      container.removeChild(select);
    };
  }, []);

  return (
    <div>
      {/* HTML method */}
      <seo-select name="framework1">
        <option value="react">React</option>
        <option value="vue">Vue</option>
        <option value="angular">Angular</option>
      </seo-select>

      {/* Programming method */}
      <div ref={selectRef}></div>
    </div>
  );
}

declare global {
  namespace JSX {
    interface IntrinsicElements {
      'seo-select': any;
      'seo-select-search': any;
    }
  }
}

Vue Integration

<template>
  <div>
    <!-- HTML method -->
    <seo-select 
      name="framework1"
      @seo-select:select="handleSelect"
    >
      <option value="vue">Vue</option>
      <option value="react">React</option>
      <option value="angular">Angular</option>
    </seo-select>

    <!-- Programming method -->
    <div ref="selectContainer"></div>
  </div>
</template>

<script setup>
import { onMounted, ref } from 'vue';
import { SeoSelect, SeoSelectSearch } from 'seo-select';

const selectContainer = ref(null);

onMounted(() => {
  const select = new SeoSelectSearch();
  select.optionItems = [
    { value: 'vue', label: 'Vue.js' },
    { value: 'nuxt', label: 'Nuxt.js' },
    { value: 'quasar', label: 'Quasar' }
  ];
  select.theme = 'rounded';
  select.showReset = true;

  selectContainer.value.appendChild(select);

  select.addEventListener('seo-select:select', (e) => {
    console.log('Vue - Selected:', e.detail);
  });
});

const handleSelect = (event) => {
  console.log('HTML - Selected:', event.detail);
};
</script>

Angular Integration

import { Component, OnInit, ElementRef, ViewChild } from '@angular/core';
import { SeoSelect, SeoSelectSearch } from 'seo-select';

@Component({
  selector: 'app-example',
  template: `
    <!-- HTML ๋ฐฉ์‹ -->
    <seo-select 
      name="framework1" 
      (seo-select:select)="handleSelect($event)"
    >
      <option value="angular">Angular</option>
      <option value="react">React</option>
      <option value="vue">Vue</option>
    </seo-select>

    <!-- ํ”„๋กœ๊ทธ๋ž˜๋ฐ ๋ฐฉ์‹ -->
    <div #selectContainer></div>
  `,
  schemas: [CUSTOM_ELEMENTS_SCHEMA] 
})
export class ExampleComponent implements OnInit {
  @ViewChild('selectContainer', { static: true }) 
  selectContainer!: ElementRef;

  ngOnInit() {
    const select = new SeoSelectSearch();
    select.optionItems = [
      { value: 'angular', label: 'Angular' },
      { value: 'ionic', label: 'Ionic' },
      { value: 'ngrx', label: 'NgRx' }
    ];
    select.multiple = true;
    select.language = 'ko';

    this.selectContainer.nativeElement.appendChild(select);

    select.addEventListener('seo-select:select', (e: CustomEvent) => {
      console.log('Programmatic - Selected:', e.detail);
    });
  }

  handleSelect(event: CustomEvent) {
    console.log('HTML - Selected:', event.detail);
  }
}

Migration Guide

From Standard HTML Select

<!-- Before: Standard HTML select -->
<select name="country">
  <option value="us">United States</option>
  <option value="kr">South Korea</option>
</select>

<!-- After: seo-select -->
<script type="module">
  import 'seo-select';
</script>
<seo-select name="country">
  <option value="us">United States</option>
  <option value="kr">South Korea</option>
</seo-select>

Adding Search Functionality

<!-- Step 1: Change import -->
<script type="module">
  import 'seo-select/components/seo-select-search';
</script>

<!-- Step 2: Change tag name -->
<seo-select-search name="country">
  <option value="us">United States</option>
  <option value="kr">South Korea</option>
</seo-select-search>

Repository

License

MIT License

Changelog

1.0.12

  • Initial release
  • Basic select functionality
  • Search component with multilingual support
  • Multiple themes (basic, float)
  • Dark mode support
  • Internationalization (EN, KO, JA, ZH)
  • Virtual scrolling for performance
  • Full accessibility support
  • TypeScript definitions
  • Fix tag style and Optimize rendering options
  • Fix seo-select-search reset logic
  • Create demo page and fix style bugs
  • Fix Scroll Style
  • Fixed bug in applying width responsiveness

Keywords

lit

FAQs

Package last updated on 30 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts