1.1.1 • Published 2 years ago

chakra-ui-search v1.1.1

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

chakra-ui-search

This is a simple search component for Chakra UI inspired in Semantic UI Search.

MIT License npm - chakra-ui-search Total Downloads - chakra-ui-search

screenshot

Installation

Yarn:

yarn add chakra-ui-search

NPM:

npm i chakra-ui-search

Basic Usage Example

import { Search } from 'chakra-ui-search'

export const SearchExample = () => {

  // Some logic...

  return (
    <Search
      placeholder="Search book..."
      value={ value }
      isLoading={ isLoading }
      input={ { iconPosition: 'left' } }
      onSearchChange={ onValueChange }
      searchResults={ results }
      resultRenderer={ book => <SearchResult book={ book } /> }
      onResultSelect={ handleResultSelect }
    />
  )

}

Props

Note: The Search component extend the Chakra UI Box component so they accept all the default styling props.

PropTypeRequiredDescriptionDefault
valuestringyesInput valueundefined
isLoadingbooleanyesIs loading resultsundefined
onSearchChange( event: React.ChangeEvent ) => voidyesAction to execute when changing the input valueundefined
resultRenderer( result: any ) => JSX.ElementyesElement that will be rendered to display the resultundefined
onResultSelect( result: any ) => voidyesAction to execute when selecting a resultundefined
searchResultsany[]noArray of search results, Each item needs to have at least one id, _id or key property[]
placeholderstringnoInput placeholder''
input{ iconPosition: 'left' | 'right'; }noInput configuration, for now you can only change its position{ iconPosition = 'left' }
noResultFoundTextstringnoText displayed when there are no results'No results found.'
resultListMaxHeightstringnoMax Height of the results list'60vh'
1.1.1

2 years ago

1.1.0

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.1.0

2 years ago