forked from reactstrap/reactstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCollapsePage.js
More file actions
76 lines (69 loc) · 2.69 KB
/
Copy pathCollapsePage.js
File metadata and controls
76 lines (69 loc) · 2.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/* eslint react/no-multi-comp: 0, react/prop-types: 0 */
import React from 'react';
import { PrismCode } from 'react-prism';
import PageTitle from '../UI/PageTitle';
import SectionTitle from '../UI/SectionTitle';
import CollapseExample from '../examples/Collapse';
import UncontrolledCollapseExample from '../examples/CollapseUncontrolled';
import CollapseEventsExample from '../examples/CollapseEvents';
const CollapseExampleSource = require('!!raw!../examples/Collapse');
const CollapseEventsExampleSource = require('!!raw!../examples/CollapseEvents');
const UncontrolledCollapseExampleSource = require('!!raw!../examples/CollapseUncontrolled');
export default class CollapsePage extends React.Component {
render() {
return (
<div>
<PageTitle title="Collapse" />
<div className="docs-example">
<CollapseExample />
</div>
<pre>
<PrismCode className="language-jsx">{CollapseExampleSource}</PrismCode>
</pre>
<SectionTitle>Properties</SectionTitle>
<pre>
<PrismCode className="language-jsx">
{`Collapse.propTypes = {
...Transition.propTypes,
isOpen: PropTypes.bool,
children: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.node),
PropTypes.node
]),
tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
className: PropTypes.node,
navbar: PropTypes.bool,
cssModule: PropTypes.object,
innerRef: PropTypes.object,
};`}
</PrismCode>
</pre>
<SectionTitle>Events</SectionTitle>
<p>
Use the <code>onEnter</code>, onEntering, onEntered, onExiting and onExited props for
callbacks when the Collapse has finished opening (entering) or closing (exiting).
</p>
<div className="docs-example">
<CollapseEventsExample />
</div>
<pre>
<PrismCode className="language-jsx">{CollapseEventsExampleSource}</PrismCode>
</pre>
<SectionTitle>Uncontrolled Collapse</SectionTitle>
<p>
For the most basic use-case, an uncontrolled component can provide the functionality
wanted without the need to manage/control the state of the component.{' '}
<code>UncontrolledCollapse</code> does not require an <code>isOpen</code> prop. Instead
pass a <code>toggler</code> prop. The <code>toggler</code> prop is a string which will run
querySelectorAll to find dom elements which will trigger toggle.
</p>
<div className="docs-example">
<UncontrolledCollapseExample />
</div>
<pre>
<PrismCode className="language-jsx">{UncontrolledCollapseExampleSource}</PrismCode>
</pre>
</div>
);
}
}