Product
Socket Now Supports uv.lock Files
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
@pressbooks/multiselect
Advanced tools
Webcomponent pressbooks-multiselect following open-wc recommendations
A web component which enhances the native <select multiple>
element, built with Lit. This web
component follows the open-wc recommendations.
It owes a great debt to prior work and research by Sarah Higley.
npm i @pressbooks/multiselect
Wrap a <select>
element with the multiple
attribute and a semantically valid label in the
<pressbooks-multiselect>
tag.
<script type="module">
import '@pressbooks/multiselect/pressbooks-multiselect.js';
</script>
<pressbooks-multiselect>
<label for="selections">Multiple Selections</label>
<select id="selections" name="selections[]">
<option value="option-1">Option 1</option>
<!-- Et cetera. -->
</select>
</pressbooks-multiselect>
If you wrap a single select or a select element without a valid label, the component will not render and your existing markup will be displayed without modification.
If the <select>
element has a relationship with a hint via the aria-describedby
attribute, the hint will be attached
to the rendered component as well. If you'd like the hint to appear after the rendered component, add the slot="after"
attribute to it:
<pressbooks-multiselect>
<label for="selections">Multiple Selections</label>
<select id="selections" name="selections[]" aria-describedby="selections-hint">
<option value="option-1">Option 1</option>
<!-- Et cetera. -->
</select>
<p id="selections-hint" slot="after">Pick some!</p>
</pressbooks-multiselect>
If you group options within the <select>
using <optgroup>
elements, the multiselect will group options using the ARIA grouped listbox pattern.
Because this web component uses the Shadow Dom, styling is limited to modification via CSS custom properties. However, there are plenty to choose from.
To scan the project for linting and formatting errors, run
npm run lint
To automatically fix linting and formatting errors, run
npm run format
To execute a single test run:
npm run test
To run the tests in interactive watch mode run:
npm run test:watch
To run a local instance of Storybook for your component, run
npm run storybook
To build a production version of Storybook, run
npm run storybook:build
For most of the tools, the configuration is in the package.json
to minimize the amount of files in your project.
If you customize the configuration a lot, you can consider moving them to individual files.
web-dev-server
npm start
To run a local development server that serves the basic demo located in demo/index.html
As this is a scoped package it must be published by someone within the Pressbooks NPM organization and must use the --access public
flag:
npm publish --access public
FAQs
Webcomponent pressbooks-multiselect following open-wc recommendations
We found that @pressbooks/multiselect demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?
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.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.