Quick search
A quick-search component
yarn add @atlaskit/quick-search
10.0.7
Patch Changes
- Updated dependencies
@atlaskit/quick-search is deprecated
@atlassian/search-dialog
instead.Note: This component is designed for internal Atlassian development.
External contributors will be able to use this component but will not be able to submit issues.
This is a barebones quick-search component that can render different types of search results.
Usage
import { QuickSearch, ObjectResult, ContainerResult, ResultItemGroup } from '@atlaskit/quick-search';
// Inside a react component with proper state and stuff.. :
render() {
return (
<QuickSearch
isLoading={this.state.isLoading}
onSearchInput={({ target }) => { this.search(target.value); }}
value={this.state.query}
>
// render search results:
<ResultItemGroup title="Issues">
<ObjectResult name="Fix this and that" objectKey="JRA-123" />
<ObjectResult name="More stuff" objectKey="JRA-124" />
</ResultItemGroup>
<ResultItemGroup title="Spaces">
<ContainerResult name="Search and Smarts" />
</ResultItemGroup>
</QuickSearch>
);
}
Objects
Objects
Like containers, objects have square avatars and a name and can be marked as private, however, instead of a free subText field, they display the name of their containing entity. They can optionally display an object key.
Props
children
default.ReactNode
= []
Search results in the form of ResultItemGroups containing Result components
default.ReactNode
isLoading
boolean
= false
Set search loading state
onSearchBlur
function
= (_) => undefined
onBlur callback for search input
event => undefined
onSearchInput
function
onInput callback for search input
function event, isAutocompleted => undefined
onSearchKeyDown
function
= (_) => undefined
onKeyDown callback for search input
event => undefined
onSearchSubmit
function
= (_) => undefined
Called when the user submits the search form without selecting a result
event => undefined
placeholder
string
= "Search"
Placeholder text for search input field
value
string
= ""
Value of the search input field
selectedResultId
union
Corresponds to the resultId
of the selected result
One of One of string, number, null
onSelectedResultIdChanged
function
Optional way of being notified when the selected result changes due to keyboard nav
id => undefined
firePrivateAnalyticsEvent
function
= (_) => undefined
Internal: injected by withAnalytics(). Fire a private analytics event
function eventName, eventData => undefined
linkComponent
default.ComponentType<any>
React component to be used for rendering links
default.ComponentTypeany
inputControls
default.ReactNode
The elements to render to the right of the search input.
default.ReactNode
autocompleteText
string
One string that is used to autocomplete the current search query