$ npm i react-component-panel --save
import {Panel,CollapsiblePanel} from 'react-component-panel'
- Panel
- CollapsiblePanel
Extends PureComponent
CollapsiblePanel
Parameters
props
Examples
class CollapsiblePanelDemo extends Component {
render() {
return (
<CollapsiblePanel title="Collapsible Panel Demo">
<p>I am collapsible panel !</p>
</CollapsiblePanel>
);
}
}
Properties
contentStyle
Object?contentClassName
String?expand
Boolean? [ true ] - 是否展开renderExpand
Function? [ expand=> {return expand ? "收起" : "展开";} ] - 展开/收起的UI样式onChange
Function? 当expand发生变化时调用
Extends PureComponent
Panel
Examples
Simple Panel Demo
class PanelDemo extends Component{
render(){
return (
<Panel title="Panel Title" renderRight={()=>{
return (
<button type="button" onClick={()=>{
alert('pressed');
}}>press me</button>
);
}}>
<p>panel content</p>
</Panel>
);
}
}
Properties
title
(String | ReactNode | HtmlElement) 标题renderRight
Function? [ ()=>null ] - 右侧按钮style
Object? 样式className
String? class style