Skip to content

Commit 3817ed8

Browse files
toofffmrchief
authored andcommitted
feat: Add no matches text in parameter (#62)
1 parent 5b76362 commit 3817ed8

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ A lightweight and fast control to render a select component that can display hie
4343
* [onNodeToggle](#onnodetoggle)
4444
* [data](#data)
4545
* [placeholderText](#placeholdertext)
46+
* [noMatchesText](#noMatchesText)
4647
* [keepTreeOnSearch](#keeptreeonsearch)
4748
* [simpleSelect](#simpleselect)
4849
* [Styling and Customization](#styling-and-customization)
@@ -225,6 +226,12 @@ Type: `string`
225226

226227
The text to display as placeholder on the search box. Defaults to `Choose...`
227228

229+
### noMatchesText
230+
231+
Type: `string`
232+
233+
The text to display when the search does not find results in the content list. Defaults to `No matches found`
234+
228235
### keepTreeOnSearch
229236

230237
Type: `bool`

src/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ class DropdownTreeSelect extends Component {
2626
onChange: PropTypes.func,
2727
onAction: PropTypes.func,
2828
onNodeToggle: PropTypes.func,
29-
simpleSelect: PropTypes.bool
29+
simpleSelect: PropTypes.bool,
30+
noMatchesText: PropTypes.string
3031
}
3132

3233
constructor (props) {
@@ -166,7 +167,7 @@ class DropdownTreeSelect extends Component {
166167
{this.state.showDropdown && (
167168
<div className={cx('dropdown-content')}>
168169
{this.state.allNodesHidden ? (
169-
<span className="no-matches">No matches found</span>
170+
<span className="no-matches">{this.props.noMatchesText || 'No matches found'}</span>
170171
) : (
171172
<Tree
172173
data={this.state.tree}

0 commit comments

Comments
 (0)