Skip to content

Commit

Permalink
Merge pull request mui#1691 from felipeptcho/master
Browse files Browse the repository at this point in the history
[Tabs] Added tabTemplate property in Tabs component for custom tab templates.
  • Loading branch information
oliviertassinari committed Oct 28, 2015
2 parents 9ccc4e1 + 470c23f commit eb3d232
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions docs/src/app/components/pages/components/tabs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ export default class TabsPage extends React.Component {
header: 'optional',
desc: 'Override the inline-styles of the tab-labels container.',
},
{
name: 'tabTemplate',
type: 'ReactClass',
header: 'optional',
desc: 'Override the default tab template used to wrap the content of each tab element.',
},
{
name: 'value',
type: 'string or number',
Expand Down
5 changes: 4 additions & 1 deletion src/tabs/tabs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const Tabs = React.createClass({
initialSelectedIndex: React.PropTypes.number,
inkBarStyle: React.PropTypes.object,
tabItemContainerStyle: React.PropTypes.object,
tabTemplate: React.PropTypes.func,
},

//for passing default theme context to children
Expand All @@ -36,6 +37,7 @@ const Tabs = React.createClass({
getDefaultProps() {
return {
initialSelectedIndex : 0,
tabTemplate: TabTemplate,
};
},

Expand Down Expand Up @@ -85,6 +87,7 @@ const Tabs = React.createClass({
style,
tabWidth,
tabItemContainerStyle,
tabTemplate,
...other,
} = this.props;

Expand Down Expand Up @@ -118,7 +121,7 @@ const Tabs = React.createClass({
}

tabContent.push(tab.props.children ?
React.createElement(TabTemplate, {
React.createElement(tabTemplate, {
key: index,
selected: this._getSelected(tab, index),
}, tab.props.children) : undefined);
Expand Down

0 comments on commit eb3d232

Please sign in to comment.