1. className: PropTypes.string,
    2. closeClassName: PropTypes.string,
    3. color: PropTypes.string, // default: 'success'
    4. isOpen: PropTypes.bool, // default: true
    5. toggle: PropTypes.func,
    6. tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
    7. fade: PropTypes.bool, // default: true
    8. // Controls the transition of the alert fading in and out
    9. // See for more details
    10. transition: PropTypes.shape(Fade.propTypes),

    Link color

    Alerts - 图1

    1. import React from 'react';
    2. import { Alert } from 'reactstrap';
    3. const Example = (props) => {
    4. return (
    5. <Alert color="success">
    6. <h4 className="alert-heading">Well done!</h4>
    7. <p>
    8. Aww yeah, you successfully read this important alert message. This example text is going
    9. to run a bit longer so that you can see how spacing within an alert works with this kind
    10. of content.
    11. </p>
    12. <hr />
    13. <p className="mb-0">
    14. Whenever you need to, be sure to use margin utilities to keep things nice and tidy.
    15. </p>
    16. </div>
    17. );
    18. };

    Dismissing

    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. UncontrolledAlert does not require isOpen nor toggle props to work.

    1. import React from 'react';
    2. import { UncontrolledAlert } from 'reactstrap';
    3. function AlertExample() {
    4. return (
    5. <UncontrolledAlert color="info">
    6. I am an alert and I can be dismissed!
    7. </UncontrolledAlert>
    8. );
    9. }
    10. export default AlertExample;

    Alerts without fade

    Alerts - 图2