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

@myuw-web-components/myuw-search

Package Overview
Dependencies
Maintainers
8
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@myuw-web-components/myuw-search

A material search field made for use with MyUW web components

  • 1.5.9
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
503
increased by17.52%
Maintainers
8
Weekly downloads
 
Created
Source

Getting Started

Include the component as follows:

<!-- import the module -->
<script type="module" src="https://cdn.my.wisc.edu/@myuw-web-components/myuw-search@latest/myuw-search.min.mjs"></script>

<!-- fallback for browsers without ES2015 module support -->
<script nomodule src="https://cdn.my.wisc.edu/@myuw-web-components/myuw-search@latest/myuw-search.min.js"></script>

<myuw-search
  slot="myuw-search"
  input-label="Search MyUW"
  button-label="Submit search"
  icon="search"
></myuw-search>

Note: The evergreen "latest" version can be used for convenience, but in production settings it is recommended to use the latest release version specifically, and upgrade only after testing!

Listen for the myuw-search CustomEvent and process the value how you like:

/*
  1. Listen for myuw-search event
  2. Get the event data from event.detail.value
  3. Do what you want with the search term!
*/
document.body.addEventListener('myuw-search', (event) => {
  const valueFromSearchBar = event.detail.value // "detail" object is part of CustomEvent spec
  /*
    Perform search logic here. For example:
      - Pass the search value as a parameter to your app's search page
  */
}, false );

Configurable properties via attributes

  • inputLabel (input-label): Text to use in the aria-label and placeholder of the search field
  • buttonLabel (button-label): Text to use for the aria-label of the search button
  • icon (icon): Text name of the material icon to use for the submit button ("search" by default)

Custom CSS properties

  • --myuw-search-border: Used to set the border color of the search component (to support themes with light background colors). Defaults to none.
  • --myuw-app-bar-color: Used by to set the color of the search button icon on small screens. Defaults to white.

Development and contribution

To run the demo app locally and test the component, run the following commands:

$ npm install
$ npm start

Cross-browser testing provided by:
BrowserStack

FAQs

Package last updated on 05 Jan 2024

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