1.0.3 • Published 5 years ago

custom-ionic-search-bar v1.0.3

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

custom-ionic-search-bar

Searchbars represent a text field that can be used to search through a collection. They can be displayed inside of a toolbar or the main content.

A Searchbar should be used instead of an input to search lists. A clear button is displayed upon entering input in the searchbar's text field. Clicking on the clear button will erase the text field and the input will remain focused. A cancel button can be enabled which will clear the input and lose the focus upon click.

Install

npm install ci-search-bar -SE

Usage

Angular

<!-- Default Searchbar -->
<ci-search-bar></ci-search-bar>

<!-- Searchbar with danger color -->
<ci-search-bar color="danger"></ci-search-bar>

<!-- Searchbar with value -->
<ci-search-bar value="Ionic"></ci-search-bar>

<!-- Searchbar with telephone type -->
<ci-search-bar type="tel"></ci-search-bar>

<!-- Searchbar with a custom debounce -->
<ci-search-bar debounce="500"></ci-search-bar>

<!-- Animated Searchbar -->
<ci-search-bar animated></ci-search-bar>

<!-- Searchbar with a placeholder -->
<ci-search-bar placeholder="Filter Schedules"></ci-search-bar>

<!-- Searchbar in a Toolbar -->
<ion-toolbar>
  <ci-search-bar></ci-search-bar>
</ion-toolbar>

Javascript

<!-- Default Searchbar -->
<ci-search-bar></ci-search-bar>

<!-- Searchbar with danger color -->
<ci-search-bar color="danger"></ci-search-bar>

<!-- Searchbar with value -->
<ci-search-bar value="Ionic"></ci-search-bar>

<!-- Searchbar with telephone type -->
<ci-search-bar type="tel"></ci-search-bar>

<!-- Searchbar with a custom debounce -->
<ci-search-bar debounce="500"></ci-search-bar>

<!-- Animated Searchbar -->
<ci-search-bar animated></ci-search-bar>

<!-- Searchbar with a placeholder -->
<ci-search-bar placeholder="Filter Schedules"></ci-search-bar>

<!-- Searchbar in a Toolbar -->
<ion-toolbar>
  <ci-search-bar></ci-search-bar>
</ion-toolbar>

Properties

PropertyAttributeDescriptionTypeDefault
animatedanimatedIf true, enable searchbar animation.booleanfalse
autocompleteautocompleteSet the input's autocomplete property."off" \| "on"'off'
autocorrectautocorrectSet the input's autocorrect property."off" \| "on"'off'
cancelButtonIconcancel-button-iconSet the cancel button icon.string'md-arrow-back'
clearIconclear-iconSet the clear icon. Defaults to "close".string \| undefinedundefined
colorcolorThe color to use from your application's color palette. Default options are: "primary", "secondary", "tertiary", "success", "warning", "danger", "light", "medium", and "dark". For more information on colors, see theming.string \| undefinedundefined
debouncedebounceSet the amount of time, in milliseconds, to wait to trigger the ionChange event after each keystroke.number250
placeholderplaceholderSet the input's placeholder.string'Search'
searchIconsearch-iconThe icon to use as the search icon.string'search'
showCancelButtonshow-cancel-buttonIf true, show the cancel button.booleanfalse
spellcheckspellcheckIf true, enable spellcheck on the input.booleanfalse
typetypeSet the type of the input."email" \| "number" \| "password" \| "search" \| "tel" \| "text" \| "url"'search'
valuevaluethe value of the searchbar.null \| string \| undefined''

Events

EventDescriptionDetail
ionBlurEmitted when the input loses focus.void
ionCancelEmitted when the cancel button is clicked.void
ionChangeEmitted when the value has changed.TextInputChangeEvent
ionClearEmitted when the clear input button is clicked.void
ionFocusEmitted when the input has focus.void
ionInputEmitted when a keyboard input ocurred.KeyboardEvent

Methods

setFocus() => void

Sets focus on the specified ci-search-bar. Use this method instead of the global input.focus().

Returns

Type: void

CSS Custom Properties

NameDescription
--backgroundBackground of the searchbar
--cancel-button-colorColor of the searchbar cancel button
--clear-button-colorColor of the searchbar clear button
--colorColor of the searchbar text
--icon-colorColor of the searchbar icon
--placeholder-colorColor of the searchbar placeholder
--placeholder-font-styleFont style of the searchbar placeholder
--placeholder-font-weightFont weight of the searchbar placeholder
--placeholder-opacityOpacity of the searchbar placeholder

Built with StencilJS

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago