Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "office-ui-fabric-react",
"comment": "ComboBox: Add getClassNAmes prop to allow complete customization of the component",
"type": "patch"
}
],
"packageName": "office-ui-fabric-react",
"email": "[email protected]"
}
Original file line number Diff line number Diff line change
Expand Up @@ -281,16 +281,26 @@ export class ComboBox extends BaseComponent<IComboBoxProps, IComboBoxState> {

let hasErrorMessage = (errorMessage && errorMessage.length > 0) ? true : false;

this._classNames = getClassNames(
getStyles(theme!, customStyles),
className!,
!!isOpen,
!!disabled,
!!required,
!!focused,
!!allowFreeform,
!!hasErrorMessage
);
this._classNames = this.props.getClassNames ?
this.props.getClassNames(
theme!,
!!isOpen,
!!disabled,
!!required,
!!focused,
!!allowFreeform,
!!hasErrorMessage,
className) :
getClassNames(
getStyles(theme!, customStyles),
className!,
!!isOpen,
!!disabled,
!!required,
!!focused,
!!allowFreeform,
!!hasErrorMessage
);

return (
<div {...divProps } ref='root' className={ this._classNames.container }>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { ISelectableDroppableTextProps } from '../../utilities/selectableOption/
import { IStyle, ITheme } from '../../Styling';
import { IButtonStyles } from '../../Button';
import { IRenderFunction } from '../../Utilities';
import { IComboBoxClassNames } from './ComboBox.classNames';

export interface IComboBox {
/**
Expand Down Expand Up @@ -101,6 +102,21 @@ export interface IComboBoxProps extends ISelectableDroppableTextProps<IComboBox>
*/
styles?: Partial<IComboBoxStyles>;

/**
* Custom function for providing the classNames for the ComboBox. Can be used to provide
* all styles for the component instead of applying them on top of the default styles.
*/
getClassNames?: (
theme: ITheme,
isOpen: boolean,
disabled: boolean,
required: boolean,
focused: boolean,
allowFreeForm: boolean,
hasErrorMessage: boolean,
className?: string
) => IComboBoxClassNames;

/**
* Styles for the caret down button.
*/
Expand Down