Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

svelte-select

Package Overview
Dependencies
Maintainers
1
Versions
196
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svelte-select

A <Select> component for Svelte apps

  • 1.4.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
28K
increased by3.27%
Maintainers
1
Weekly downloads
 
Created
Source

svelte-select (demo)

A select/autocomplete component for Svelte apps. With support for grouping, filtering, async and more.

Installation

yarn add svelte-select

Usage

<Select {items}></Select>

<script>
  import Select from 'svelte-select';

  export default {
    components: { Select },

    data() {
      return {
         items: [
          {value: 'chocolate', label: 'Chocolate'},
          {value: 'pizza', label: 'Pizza'},
          {value: 'cake', label: 'Cake'},
          {value: 'chips', label: 'Chips'},
          {value: 'ice-cream', label: 'Ice Cream'},
        ]
      };
    }
  };
</script>

API

PropTypeDefaultDescription
itemsString-array of items
filterTextString-text to filter list labels by
placeholderString-placeholder text
optionIdentifierString'value'override default identifier
listOpenBooleanfalseopen/close list
containerStylesString-add/override container styles
selectedValue--Selected value(s)
groupByFunction-Function to group list items
isClearableBooleanfalseDisable clear all
isDisabledBooleanfalseDisable select
isMultiBooleanfalseEnable multi select
isSearchableBooleantrueDisable search/filtering
groupFilterFunction(groups) => groupsgroup filter function
getOptionLabelFunction(option) => option.labelget option label function
getSelectionLabelFunction(option) => option.labelget selection label function
ItemComponentItemitem component
SelectionComponentSelectionselection component
MultiSelectionComponentMultiSelectionmulti selection component
loadOptionsPromise-Method that returns a Promise that updates items
noOptionsMessageString'No options'Message to display when there are no items
hideEmptyStateBooleanfalseHide list when no options

Development

yarn global add serve@8
yarn
yarn dev
yarn test:browser

Configuring webpack

If you're using webpack with svelte-loader, make sure that you add "svelte" to resolve.mainFields in your webpack config. This ensures that webpack imports the uncompiled component (src/index.html) rather than the compiled version (index.mjs) — this is more efficient.

If you're using Rollup with rollup-plugin-svelte, this will happen automatically.

License

LIL

Keywords

FAQs

Package last updated on 04 Feb 2019

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc