react-toolbox/components/snackbar
rubenmoya f0067083df Fix eslint errors 2018-02-20 22:26:44 +01:00
..
Snackbar.d.ts TypeScript: snack-bar label accepts element 2018-01-03 11:08:14 +01:00
Snackbar.js Fix eslint errors 2018-02-20 22:26:44 +01:00
index.d.ts Restructure typescript definitions (#1114) 2017-01-18 08:37:37 +01:00
index.js Update dependencies and linter (#1180) 2017-01-26 18:05:32 +01:00
readme.md Migrate styles to PostCSS (#666) 2017-01-05 02:42:18 +01:00
theme.css Fixes #1127 2017-01-18 10:56:03 +01:00

readme.md

Snackbar

Snackbars provide lightweight feedback about an operation by showing a brief message at the bottom of the screen. Snackbars can contain an action.

import { Button, Snackbar } from 'react-toolbox';

class SnackbarTest extends React.Component {
  handleClick = () => {
    this.refs.snackbar.show();
  };

  handleSnackbarClick = () => {
    this.refs.snackbar.hide();
  };

  render () {
    return (
      <section>
        <Button label='Show Snackbar' raised onClick={this.handleClick} />
        <Snackbar
          action='Nice'
          label='A new developer started using React Toolbox'
          onClick={this.handleSnackbarClick}
          ref='snackbar'
          type='accept'
      />
      </section>
    );
  }
}

This component can be styled by context providing a theme with the key RTSnackbar through the theme provider.

Properties

Name Type Default Description
action String Label for the action component inside the Snackbar.
active Boolean false If true, the snackbar will be active.
children String or Element false Text or node to be displayed in the content as alternative to label.
className String '' Additional class name to provide custom styling.
label String or Element Text to display in the content.
onClick Function Callback function that will be called when the button action is clicked.
onTimeout Function Callback function when finish the set timeout.
timeout Number Amount of time in milliseconds after the Snackbar will be automatically hidden.
type String Indicates the action type. Can be accept, warning or cancel

Theme

Name Description
accept Added to the root element in case it's accept type.
active Added to the root element when its active.
button Used for the button inside the component.
cancel Added to the root element in case it's cancel type.
label Used for the label element.
portal Used for the portal container element.
snackbar Used as the className for the root element of the component.
warning Added to the root element in case it's warning type.