From 83fb208249a83b1f01374fe12321a32b3ca0f2f6 Mon Sep 17 00:00:00 2001 From: Andrey Kalashnikov Date: Fri, 1 Apr 2016 00:19:17 +0300 Subject: [PATCH] Add support for a custom className for active tab --- lib/components/Tab.js | 20 ++++++++++++-------- lib/components/TabList.js | 24 +++++++++++++++++++++++- lib/components/__tests__/Tab-test.js | 13 +++++++++++++ 3 files changed, 48 insertions(+), 9 deletions(-) diff --git a/lib/components/Tab.js b/lib/components/Tab.js index 51090143ed..0eed25a59a 100644 --- a/lib/components/Tab.js +++ b/lib/components/Tab.js @@ -24,6 +24,7 @@ module.exports = React.createClass({ selected: PropTypes.bool, disabled: PropTypes.bool, panelId: PropTypes.string, + activeTabClassName: PropTypes.string, children: PropTypes.oneOfType([ PropTypes.array, PropTypes.object, @@ -49,16 +50,19 @@ module.exports = React.createClass({ }, render() { + const className = cx( + 'ReactTabs__Tab', + this.props.className, + { + 'ReactTabs__Tab--selected': this.props.selected, + 'ReactTabs__Tab--disabled': this.props.disabled + }, + this.props.activeTabClassName ? this.props.activeTabClassName : '' + ); + return (