1.0.0 • Published 4 years ago

@feizheng/react-collapse v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

react-collapse

Collapse for react.

version license size download

installation

npm install -S @feizheng/react-collapse

update

npm update @feizheng/react-collapse

properties

NameTypeRequiredDefaultDescription
classNamestringfalse-The extended className for component.
valueobjectfalsenullThe changed value.
onChangefuncfalsenoopThe change handler.

usage

  1. import css

    @import "~@feizheng/react-collapse/dist/style.scss";
    
    // customize your styles:
    $react-collapse-options: ()
  2. import js

    import NxOfflineSw from '@feizheng/next-offline-sw';
    import ReactGithubCorner from '@feizheng/react-github-corner';
    import ReactSwUpdateTips from '@feizheng/react-sw-update-tips';
    import React from 'react';
    import ReactDOM from 'react-dom';
    import ReactCollapse from '@feizheng/react-collapse';
    import './assets/style.scss';
    
    class App extends React.Component {
      state = { hasUpdate: false };
    
      componentDidMount() {
        NxOfflineSw.install({
          onUpdateReady: () => {
            this.setState({ hasUpdate: true });
          }
        });
      }
    
      render() {
        return (
          <div className="p-3 app-container">
            <ReactCollapse className="bg-gray-800 mb-5 text-white" />
            <button className="button">I am a button</button>
            <ReactSwUpdateTips value={this.state.hasUpdate} />
            <ReactGithubCorner value="https://github.com/afeiship/react-collapse" />
          </div>
        );
      }
    }
    
    ReactDOM.render(<App />, document.getElementById('app'));

documentation

license

Code released under the MIT license.