Skip to content
Merged
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"changes": [{
"packageName": "office-ui-fabric-react",
"comment": "Add clearButtonProps prop to SearchBox.types.ts with the IButtonPropsType. This is passed to the icon button in SearchBox.base.tsx",
"type": "minor"
}],
"packageName": "office-ui-fabric-react",
"email": "[email protected]"
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class SearchBoxBase extends BaseComponent<ISearchBoxProps, ISearchBoxStat
}

public render() {
let { labelText, className, disabled, underlined, getStyles, theme } = this.props;
let { labelText, className, disabled, underlined, getStyles, theme, clearButtonProps } = this.props;
let { value, hasFocus, id } = this.state;

const classNames = getClassNames(getStyles!, {
Expand Down Expand Up @@ -89,7 +89,12 @@ export class SearchBoxBase extends BaseComponent<ISearchBoxProps, ISearchBoxStat
/>
{ value!.length > 0 &&
<div className={ classNames.clearButton }>
<IconButton styles={ { root: { height: 'auto' }, icon: { fontSize: '12px' } } } onClick={ this._onClearClick } iconProps={ { iconName: 'Clear' } } />
<IconButton
styles={ { root: { height: 'auto' }, icon: { fontSize: '12px' } } }
onClick={ this._onClearClick }
iconProps={ { iconName: 'Clear' } }
{ ...clearButtonProps }
/>
</div>
}
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as React from 'react';
import { ITheme, IStyle } from '../../Styling';
import { IStyleFunction } from '../../Utilities';
import { IButtonProps } from '../Button';

export interface ISearchBox {
/**
Expand Down Expand Up @@ -64,6 +65,11 @@ export interface ISearchBoxProps extends React.InputHTMLAttributes<HTMLInputElem
*/
ariaLabel?: string;

/**
* The props for the clear button.
*/
clearButtonProps?: IButtonProps;

/**
* Whether or not the SearchBox is underlined.
* @default false
Expand Down