@spectrum-web-components/search
TypeScript icon, indicating that this package has built-in type declarations

1.6.0 • Public • Published

Description

The <sp-search> element delivers a single input field with a "reset" button as well as a mangifying glass icon with which to power search interactions.

Usage

See it on NPM! How big is this package in your project? Try it on webcomponents.dev

yarn add @spectrum-web-components/search

Import the side effectful registration of <sp-search> via:

import '@spectrum-web-components/search/sp-search.js';

When looking to leverage the Search base class as a type and/or for extension purposes, do so via:

import { Search } from '@spectrum-web-components/search';

Sizes

Small
<sp-search size="s"></sp-search>
<sp-search size="s" disabled></sp-search>
Medium
<sp-search></sp-search>
<sp-search disabled></sp-search>
Large
<sp-search size="l"></sp-search>
<sp-search size="l" disabled></sp-search>
Extra Large
<sp-search size="xl"></sp-search>
<sp-search size="xl" disabled></sp-search>

Variants

Quiet

<sp-search quiet></sp-search>
<sp-search quiet disabled></sp-search>

Events

The submit event fires when the <sp-search> is submitted. This is a non-composed event inline with what you would expect a <form />{:target="_blank"} to fire. If you choose to prevent the default of this event, the default action for the underlying <form /> element will also be prevented, which will allow you to handle the search action in javascript.

Properties

holdValueOnEscape

  • Type: boolean
  • Default: false

If holdValueOnEscape controls whether the typed value should be held (i.e., not cleared or reset) when the Escape key is pressed. If set to true, pressing the Escape key will not affect the value in the search field.

Package Sidebar

Install

npm i @spectrum-web-components/search

Weekly Downloads

2,680

Version

1.6.0

License

Apache-2.0

Unpacked Size

133 kB

Total Files

34

Last publish

Collaborators

  • caseyisonit
  • taratadobe
  • rajrock38
  • jnjosh
  • nikkimk
  • rubenc
  • jianliao79