diff --git a/packages/react-bootstrap-table2-example/examples/search/clear-search-button.js b/packages/react-bootstrap-table2-example/examples/search/clear-search-button.js new file mode 100644 index 0000000..efc4511 --- /dev/null +++ b/packages/react-bootstrap-table2-example/examples/search/clear-search-button.js @@ -0,0 +1,86 @@ +/* eslint react/prop-types: 0 */ +import React from 'react'; + +import BootstrapTable from 'react-bootstrap-table-next'; +import ToolkitProvider, { Search } from 'react-bootstrap-table2-toolkit'; +import Code from 'components/common/code-block'; +import { productsGenerator } from 'utils/common'; + +const { SearchBar, ClearSearchButton } = Search; +const products = productsGenerator(); + +const columns = [{ + dataField: 'id', + text: 'Product ID' +}, { + dataField: 'name', + text: 'Product Name' +}, { + dataField: 'price', + text: 'Product Price' +}]; + +const sourceCode = `\ +import BootstrapTable from 'react-bootstrap-table-next'; +import ToolkitProvider, { Search } from 'react-bootstrap-table2-toolkit'; + +const { SearchBar, ClearSearchButton } = Search; + +const columns = [{ + dataField: 'id', + text: 'Product ID' +}, { + dataField: 'name', + text: 'Product Name' +}, { + dataField: 'price', + text: 'Product Price' +}]; + + + { + props => ( +
+

Input something at below input field:

+ + +
+ +
+ ) + } +
+`; + +export default () => ( +
+ + { + props => ( +
+

Input something at below input field:

+ + +
+ +
+ ) + } +
+ { sourceCode } +
+); diff --git a/packages/react-bootstrap-table2-example/stories/index.js b/packages/react-bootstrap-table2-example/stories/index.js index 855287d..09ac547 100644 --- a/packages/react-bootstrap-table2-example/stories/index.js +++ b/packages/react-bootstrap-table2-example/stories/index.js @@ -172,6 +172,7 @@ import RemoteStandalonePaginationTable from 'examples/pagination/remote-standalo // search import SearchTable from 'examples/search'; +import ClearSearchButton from 'examples/search/clear-search-button'; import DefaultSearch from 'examples/search/default-search'; import DefaultCustomSearch from 'examples/search/default-custom-search'; import FullyCustomSearch from 'examples/search/fully-custom-search'; @@ -394,6 +395,7 @@ storiesOf('Pagination', module) storiesOf('Table Search', module) .addDecorator(bootstrapStyle()) .add('Basic Search Table', () => ) + .add('Clear Search Button', () => ) .add('Default Search Table', () => ) .add('Default Custom Search', () => ) .add('Fully Custom Search', () => )