Is it possible to make the length of the search bar wider? I am not talking about the actual size because there is a size property, just length.
Also, the defaultValue in Search doesn't seem to work at all, is it just me? The code I am using is basiclly a copy paste of this one: https://react.semantic-ui.com/modules/search/#types-category I just added:
let defaultValue = "Search"
before the render and my Search call is like so (Added the defaultValue part that doesn't show)
<Search
defaultValue={defaultValue}
category
loading={isLoading}
onResultSelect={this.handleResultSelect}
onSearchChange={_.debounce(this.handleSearchChange, 500, { leading: true })}
results={results}
value={value}
{...this.props}
/>
You can do something like this:
set the value attribute like value || defaultValue
value || defaultValue
- This will set the default value for the search field if the value is empty
Set a class name to the search component and change the width via css
<Search className="search-bar" loading={isLoading} onResultSelect={this.handleResultSelect} onSearchChange={_.debounce(this.handleSearchChange, 500, { leading: true })} results={results} value={value || defaultValue} {...this.props} />
.search-bar{ width: 500px; .input{ width: 100%; } }
Here is the live demo
Hope it helps :)
Yes, we can adjust search bar length by changing padding size in style.
.search-bar{
padding-left:50px;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.