Slim advanced select dropdown
The select dropdown, reimagined.
A lightweight, dependency-free replacement for the native `` — single and multi-select, search, optgroups, remote data, modal mode on mobile, and full theming through CSS variables. Drop it into any stack, or use the official Vue and React wrappers.
Full docs, live demos, and copy-paste examples: slimselectjs.com
Select, upgraded
off | on | mobile) — centered panel with backdrop; mobile-friendly by defaultLooks like your product
--ss-* CSS custom properties — no fighting class specificityBuilt to ship
prefers-reduced-motion respectedFramework ready
npm install slim-select
import SlimSelect from 'slim-select'
import 'slim-select/styles' // or: import 'slim-select/scss'
new SlimSelect({
select: '#selectElement'
})
Value 1
Slim Select is styled with CSS variables. Set them on a wrapper around your select (or on :root for a global theme):
.my-form {
--ss-primary-color: #2563eb;
--ss-bg-color: #ffffff;
--ss-font-color: #1e293b;
--ss-border-color: #e2e8f0;
--ss-border-radius: 8px;
--ss-main-height: 44px;
}
See the full token list and live themes on the Style docs.
Pass an array of options and optgroups instead of (or in addition to) native `` elements:
new SlimSelect({
select: '#selectElement',
data: [
{ text: 'Value 1', value: 'value1' },
{
label: 'Group label',
options: [
{ text: 'Value 2', value: 'value2' },
{ text: 'Value 3', value: 'value3' }
]
}
]
})
…
All fields are optional. Values shown are defaults.
…
const slim = new SlimSelect({ select: '#selectElement' })
slim.enable()
slim.disable()
slim.getData()
slim.setData(data)
slim.getSelected() // string[]
slim.setSelected(['value1', 'value2'])
slim.addOption(option)
slim.open()
slim.close()
slim.search('searchValue')
slim.destroy()
Official Vue 3 component with v-model and full TypeScript support.
npm install slim-select
Note: Pass options via the
:dataprop. Native `` slot children are not supported in the Vue wrapper.
Official React component with hooks and ref access to the underlying instance.
npm install slim-select
import { useState } from 'react'
import SlimSelect from 'slim-select/react'
import 'slim-select/styles'
function MyComponent() {
const [selected, setSelected] = useState('value2')
const options = [
{ text: 'Value 1', value: 'value1' },
{ text: 'Value 2', value: 'value2' },
{ text: 'Value 3', value: 'value3' }
]
return
}
Note: Pass options via the
dataprop. Native `` children are not supported in the React wrapper.
import { useRef } from 'react'
import SlimSelect, { SlimSelectRef } from 'slim-select/react'
import 'slim-select/styles'
function MyComponent() {
const slimRef = useRef(null)
return (
<>
slimRef.current?.slimSelect?.open()}>Open
)
}
No open issues yet, or sync has not completed.