Skip to content

Commit

Permalink
[TreeView] Add TransitionProps support
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Jan 12, 2020
1 parent 25f948c commit 72608f5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/pages/api/tree-item.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ You can learn more about the difference by [reading this guide](/guides/minimizi
| <span class="prop-name">label</span> | <span class="prop-type">node</span> | | The tree node label. |
| <span class="prop-name required">nodeId&nbsp;*</span> | <span class="prop-type">string</span> | | The id of the node. |
| <span class="prop-name">TransitionComponent</span> | <span class="prop-type">elementType</span> | <span class="prop-default">Collapse</span> | The component used for the transition. [Follow this guide](/components/transitions/#transitioncomponent-prop) to learn more about the requirements for this component. |
| <span class="prop-name">TransitionProps</span> | <span class="prop-type">object</span> | | Props applied to the [`Transition`](http://reactcommunity.org/react-transition-group/transition#Transition-props) element. |

The `ref` is forwarded to the root element.

Expand Down
4 changes: 4 additions & 0 deletions packages/material-ui-lab/src/TreeItem/TreeItem.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ export interface TreeItemProps
* [Follow this guide](/components/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.
*/
TransitionComponent?: React.ComponentType<TransitionProps>;
/**
* Props applied to the [`Transition`](http://reactcommunity.org/react-transition-group/transition#Transition-props) element.
*/
TransitionProps?: TransitionProps;
}

export type TreeItemClassKey =
Expand Down
6 changes: 6 additions & 0 deletions packages/material-ui-lab/src/TreeItem/TreeItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ const TreeItem = React.forwardRef(function TreeItem(props, ref) {
onFocus,
onKeyDown,
TransitionComponent = Collapse,
TransitionProps,
...other
} = props;

Expand Down Expand Up @@ -298,6 +299,7 @@ const TreeItem = React.forwardRef(function TreeItem(props, ref) {
in={expanded}
component="ul"
role="group"
{...TransitionProps}
>
{children}
</TransitionComponent>
Expand Down Expand Up @@ -365,6 +367,10 @@ TreeItem.propTypes = {
* [Follow this guide](/components/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.
*/
TransitionComponent: PropTypes.elementType,
/**
* Props applied to the [`Transition`](http://reactcommunity.org/react-transition-group/transition#Transition-props) element.
*/
TransitionProps: PropTypes.object,
};

export default withStyles(styles, { name: 'MuiTreeItem' })(TreeItem);

0 comments on commit 72608f5

Please sign in to comment.