@material/snackbar

  • Version 14.0.0
  • Published
  • 507 kB
  • 13 dependencies
  • MIT license

Install

npm i @material/snackbar
yarn add @material/snackbar
pnpm add @material/snackbar

Overview

The Material Components for the web snackbar component

Index

Variables

variable cssClasses

const cssClasses: { CLOSING: string; OPEN: string; OPENING: string };
  • Copyright 2018 Google Inc.

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

variable numbers

const numbers: {
DEFAULT_AUTO_DISMISS_TIMEOUT_MS: number;
INDETERMINATE: number;
MAX_AUTO_DISMISS_TIMEOUT_MS: number;
MIN_AUTO_DISMISS_TIMEOUT_MS: number;
SNACKBAR_ANIMATION_CLOSE_TIME_MS: number;
SNACKBAR_ANIMATION_OPEN_TIME_MS: number;
ARIA_LIVE_DELAY_MS: number;
};

    variable strings

    const strings: {
    ACTION_SELECTOR: string;
    ARIA_LIVE_LABEL_TEXT_ATTR: string;
    CLOSED_EVENT: string;
    CLOSING_EVENT: string;
    DISMISS_SELECTOR: string;
    LABEL_SELECTOR: string;
    OPENED_EVENT: string;
    OPENING_EVENT: string;
    REASON_ACTION: string;
    REASON_DISMISS: string;
    SURFACE_SELECTOR: string;
    };

      Classes

      class MDCSnackbar

      class MDCSnackbar extends MDCComponent<MDCSnackbarFoundation> {}

        property actionButtonText

        actionButtonText: string;

          property closeOnEscape

          closeOnEscape: boolean;

            property isOpen

            readonly isOpen: boolean;

              property labelText

              labelText: string;

                property timeoutMs

                timeoutMs: number;

                  method attachTo

                  static attachTo: (root: Element) => MDCSnackbar;

                    method close

                    close: (reason?: string) => void;
                    • Parameter reason

                      Why the snackbar was closed. Value will be passed to CLOSING_EVENT and CLOSED_EVENT via the event.detail.reason property. Standard values are REASON_ACTION and REASON_DISMISS, but custom client-specific values may also be used if desired.

                    method destroy

                    destroy: () => void;

                      method getDefaultFoundation

                      getDefaultFoundation: () => MDCSnackbarFoundation;

                        method initialize

                        initialize: (announcerFactory?: MDCSnackbarAnnouncerFactory) => void;

                          method initialSyncWithDOM

                          initialSyncWithDOM: () => void;

                            method open

                            open: () => void;

                              class MDCSnackbarFoundation

                              class MDCSnackbarFoundation extends MDCFoundation<MDCSnackbarAdapter> {}

                                constructor

                                constructor(adapter?: Partial<MDCSnackbarAdapter>);

                                  property cssClasses

                                  static readonly cssClasses: { CLOSING: string; OPEN: string; OPENING: string };

                                    property defaultAdapter

                                    static readonly defaultAdapter: MDCSnackbarAdapter;

                                      property numbers

                                      static readonly numbers: {
                                      DEFAULT_AUTO_DISMISS_TIMEOUT_MS: number;
                                      INDETERMINATE: number;
                                      MAX_AUTO_DISMISS_TIMEOUT_MS: number;
                                      MIN_AUTO_DISMISS_TIMEOUT_MS: number;
                                      SNACKBAR_ANIMATION_CLOSE_TIME_MS: number;
                                      SNACKBAR_ANIMATION_OPEN_TIME_MS: number;
                                      ARIA_LIVE_DELAY_MS: number;
                                      };

                                        property strings

                                        static readonly strings: {
                                        ACTION_SELECTOR: string;
                                        ARIA_LIVE_LABEL_TEXT_ATTR: string;
                                        CLOSED_EVENT: string;
                                        CLOSING_EVENT: string;
                                        DISMISS_SELECTOR: string;
                                        LABEL_SELECTOR: string;
                                        OPENED_EVENT: string;
                                        OPENING_EVENT: string;
                                        REASON_ACTION: string;
                                        REASON_DISMISS: string;
                                        SURFACE_SELECTOR: string;
                                        };

                                          method close

                                          close: (reason?: string) => void;
                                          • Parameter reason

                                            Why the snackbar was closed. Value will be passed to CLOSING_EVENT and CLOSED_EVENT via the event.detail.reason property. Standard values are REASON_ACTION and REASON_DISMISS, but custom client-specific values may also be used if desired.

                                          method destroy

                                          destroy: () => void;

                                            method getCloseOnEscape

                                            getCloseOnEscape: () => boolean;

                                              method getTimeoutMs

                                              getTimeoutMs: () => number;

                                                method handleActionButtonClick

                                                handleActionButtonClick: (_evt: MouseEvent) => void;

                                                  method handleActionIconClick

                                                  handleActionIconClick: (_evt: MouseEvent) => void;

                                                    method handleKeyDown

                                                    handleKeyDown: (evt: KeyboardEvent) => void;

                                                      method isOpen

                                                      isOpen: () => boolean;

                                                        method open

                                                        open: () => void;

                                                          method setCloseOnEscape

                                                          setCloseOnEscape: (closeOnEscape: boolean) => void;

                                                            method setTimeoutMs

                                                            setTimeoutMs: (timeoutMs: number) => void;

                                                              Interfaces

                                                              interface MDCSnackbarAdapter

                                                              interface MDCSnackbarAdapter {}
                                                              • Defines the shape of the adapter expected by the foundation. Implement this adapter for your framework of choice to delegate updates to the component in your framework of choice. See architecture documentation for more details. https://github.com/material-components/material-components-web/blob/master/docs/code/architecture.md

                                                              method addClass

                                                              addClass: (className: string) => void;

                                                                method announce

                                                                announce: () => void;

                                                                  method notifyClosed

                                                                  notifyClosed: (reason: string) => void;

                                                                    method notifyClosing

                                                                    notifyClosing: (reason: string) => void;

                                                                      method notifyOpened

                                                                      notifyOpened: () => void;

                                                                        method notifyOpening

                                                                        notifyOpening: () => void;

                                                                          method removeClass

                                                                          removeClass: (className: string) => void;

                                                                            interface MDCSnackbarCloseEvent

                                                                            interface MDCSnackbarCloseEvent extends Event {}

                                                                              property detail

                                                                              readonly detail: MDCSnackbarCloseEventDetail;

                                                                                interface MDCSnackbarCloseEventDetail

                                                                                interface MDCSnackbarCloseEventDetail {}

                                                                                  property reason

                                                                                  reason?: string;

                                                                                    Type Aliases

                                                                                    type MDCSnackbarAnnouncer

                                                                                    type MDCSnackbarAnnouncer = (ariaEl: Element, labelEl?: Element) => void;
                                                                                    • Copyright 2019 Google Inc.

                                                                                      Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

                                                                                      The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

                                                                                      THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

                                                                                    type MDCSnackbarAnnouncerFactory

                                                                                    type MDCSnackbarAnnouncerFactory = () => MDCSnackbarAnnouncer;

                                                                                      Namespaces

                                                                                      namespace util

                                                                                      module 'util.d.ts' {}
                                                                                      • Copyright 2018 Google Inc.

                                                                                        Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

                                                                                        The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

                                                                                        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

                                                                                      function announce

                                                                                      announce: (ariaEl: Element, labelEl?: Element) => void;
                                                                                      • Copyright 2018 Google Inc.

                                                                                        Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

                                                                                        The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

                                                                                        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

                                                                                      Package Files (7)

                                                                                      Dependencies (13)

                                                                                      Dev Dependencies (0)

                                                                                      No dev dependencies.

                                                                                      Peer Dependencies (0)

                                                                                      No peer dependencies.

                                                                                      Badge

                                                                                      To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                      You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@material/snackbar.

                                                                                      • Markdown
                                                                                        [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@material/snackbar)
                                                                                      • HTML
                                                                                        <a href="https://www.jsdocs.io/package/@material/snackbar"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>