
Security News
pnpm 12’s Rust Rewrite Cuts Install Times by Up to 90%
pnpm 12 rewrites the package manager in Rust, cutting install times by up to 90% while preserving pnpm 11 workflows and lockfiles.
@strata-packages/forms
Advanced tools
Interactive form controls for Strata CSS — custom select with every variant developers need.
Interactive form controls for Strata CSS — a fully accessible custom select with every variant developers need. Zero dependencies. Works standalone or as part of Strata.
Looking for date / time pickers? See
@strata-packages/picker.
npm install @strata-packages/forms
<link rel="stylesheet" href="node_modules/@strata-packages/forms/forms.css">
<script src="node_modules/@strata-packages/forms/forms.js"></script>
Available as StrataForms.
The forms package is bundled into Strata's component build — do not load forms.js separately when using the full Strata bundle.
Available as Strata.Forms.
<select data-st-select name="service">
<option value="">Choose a service…</option>
<option value="hair">Hair Styling</option>
<option value="nails">Nails</option>
</select>
const sel = StrataForms.select('#mySelect', options)
All variants are composable — combine any set of options together.
StrataForms.select('#el', { placeholder: 'Choose…' })
<select data-st-select data-st-multi name="services[]" multiple>
StrataForms.select('#el', { multiSelect: true, placeholder: 'Choose services…' })
Selected items render as removable chips in the trigger.
StrataForms.select('#el', { multiSelect: true, maxItems: 3 })
Caps visible chips at N, shows +N badge for the rest.
StrataForms.select('#el', { multiSelect: true, maxDisplay: 3 })
<select data-st-select data-st-searchable>
StrataForms.select('#el', { searchable: true })
Shows a × button when a value is selected.
<select data-st-select data-st-clearable>
Reads <optgroup> from the native select automatically — no config needed.
<select data-st-select>
<optgroup label="Hair">
<option value="cut">Hair Cut</option>
<option value="color">Hair Colour</option>
</optgroup>
<optgroup label="Nails">
<option value="mani">Manicure</option>
</optgroup>
</select>
User can type a new value and add it. Requires searchable: true.
<select data-st-select data-st-multi data-st-searchable data-st-creatable multiple>
StrataForms.select('#el', { multiSelect: true, searchable: true, creatable: true })
StrataForms.select('#el', {
renderOption: opt => `
<img src="${opt.dataset.avatar}" class="st-sel-avatar">
<span><strong>${opt.text}</strong><small>${opt.dataset.role}</small></span>`,
renderValue: opt => `<img src="${opt.dataset.avatar}" class="st-sel-avatar"> ${opt.text}`,
})
StrataForms.select('#el', {
searchable: true,
loadOptions: (query, callback) => {
fetch(`/api/search?q=${query}`)
.then(r => r.json())
.then(items => callback(items)) // items: [{ value, text }]
},
})
Dropdown expands to fit content. Flips alignment automatically at viewport edge.
<select data-st-select data-st-auto-width data-st-max-width="320">
StrataForms.select('#el', { autoWidth: true, maxWidth: 320 })
Dropdown stays open while ticking. Includes Select All and group-level checkboxes.
<select data-st-select data-st-checkboxes data-st-checkbox-display="count" multiple>
StrataForms.select('#el', {
checkboxes: true,
checkboxDisplay: 'count', // 'chips' | 'count' | 'list'
selectAll: true,
})
checkboxDisplay values:
chips — removable chip tags (default)count — "3 of 6 selected"list — "Hair, Nails, Facial"| Option | Type | Data attribute | Description |
|---|---|---|---|
placeholder | string | data-st-placeholder | Trigger text when nothing selected |
multiSelect | bool | data-st-multi | Multiple selection mode |
searchable | bool | data-st-searchable | Search input in dropdown |
clearable | bool | data-st-clearable | × clear button |
creatable | bool | data-st-creatable | Add new options by typing |
maxItems | number | data-st-max-items | Cap multi-select count |
maxDisplay | number | data-st-max-display | Cap visible chips, show +N badge |
checkboxes | bool | data-st-checkboxes | Checkbox UI, dropdown stays open |
checkboxDisplay | string | data-st-checkbox-display | chips / count / list |
selectAll | bool | data-st-no-select-all to disable | Select All checkbox header |
autoWidth | bool | data-st-auto-width | Expand dropdown to content width |
maxWidth | number | data-st-max-width | Cap auto-width expansion |
renderOption | function | JS only | Custom HTML per option in dropdown |
renderValue | function | JS only | Custom HTML for selected value / chip |
loadOptions | function | JS only | Async option loading |
const sel = StrataForms.select('#el', options)
sel.open()
sel.close()
sel.setValue('hair') // single — set by value
sel.setValues(['hair','nails']) // multi — set multiple
sel.getValue() // single → string; multi → string[]
sel.clear() // deselect all
sel.destroy() // remove custom select, restore native
document.addEventListener('st:select:change', e => {
// e.detail: { select, value, text, values, index }
// value / text: string (single) or first item (multi)
// values: always an array — use this for multi
})
document.addEventListener('st:select:open', e => { /* e.detail: { select } */ })
document.addEventListener('st:select:close', e => { /* e.detail: { select } */ })
<select> stays in the DOM — form submission works with any backendname attribute preserved — $_POST['service'] or request.POST['service'] works normallyname="services[]" (PHP) or name="services" (Django / Rails)required attribute triggers visible error state on the custom trigger when form validation fails<option selected> is respected at init timeOverride per-instance, per-context, or per-theme — no !important needed.
/* Per theme */
[data-st-theme="dark"] .st-select-trigger {
--st-select-bg: #1e1e2e;
--st-select-border: #45475a;
}
/* Per instance */
<select style="--st-select-height: 3rem" data-st-select>
renderOption / renderValue output is set via innerHTML — sanitise untrusted data before passingloadOptions does not debounce internally — add your own debounce wrapper if needed<option> elements added after init are not reflected — call destroy() then re-init to refreshMIT © Aftab Ibrahim Kazi
FAQs
Interactive form controls for Strata CSS — custom select with every variant developers need.
We found that @strata-packages/forms demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.

Security News
pnpm 12 rewrites the package manager in Rust, cutting install times by up to 90% while preserving pnpm 11 workflows and lockfiles.

Security News
Socket CTO Ahmad Nassri joins AppSec leaders at Black Hat to discuss active malware, package manager risks, and software supply chain defense.

Research
/Security News
Thirteen malicious Packagist themes expose visitors on unpatched iPhones to a WebKit-to-kernel exploit chain that steals device data and wallet seeds.