--- order: 4 title: 搜索框 --- 带有搜索按钮的输入框。 ````jsx import { Input, Button } from 'antd'; import classNames from 'classnames'; const InputGroup = Input.Group; const SearchInput = React.createClass({ getInitialState() { return { value: '', focus: false, }; }, handleInputChange(e) { this.setState({ value: e.target.value, }); }, handleFocusBlur(e) { this.setState({ focus: e.target === document.activeElement, }); }, handleSearch() { if (this.props.onSearch) { this.props.onSearch(this.state.value); } }, render() { const { style, size, ...restProps } = this.props; const btnCls = classNames({ 'ant-search-btn': true, 'ant-search-btn-noempty': !!this.state.value.trim(), }); const searchCls = classNames({ 'ant-search-input': true, 'ant-search-input-focus': this.state.focus, }); return (