@material/switch

  • Version 11.0.0
  • Published
  • 567 kB
  • 10 dependencies
  • MIT license

Install

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

Overview

The Material Components for the web switch component

Index

Namespaces

namespace @material/switch

module '@material/switch' {}

    variable cssClasses

    const cssClasses: { CHECKED: string; DISABLED: string };
    • CSS classes used by the switch.

    variable strings

    const strings: {
    ARIA_CHECKED_ATTR: string;
    NATIVE_CONTROL_SELECTOR: string;
    RIPPLE_SURFACE_SELECTOR: string;
    };
    • String constants used by the switch.

    class MDCSwitch

    class MDCSwitch
    extends MDCComponent<MDCSwitchFoundation>
    implements MDCRippleCapableSurface {}

      property checked

      checked: boolean;

        property disabled

        disabled: boolean;

          property ripple

          readonly ripple: any;

            method attachTo

            static attachTo: (root: HTMLElement) => MDCSwitch;

              method destroy

              destroy: () => void;

                method getDefaultFoundation

                getDefaultFoundation: () => MDCSwitchFoundation;

                  method initialSyncWithDOM

                  initialSyncWithDOM: () => void;

                    class MDCSwitchFoundation

                    class MDCSwitchFoundation extends MDCFoundation<MDCSwitchAdapter> {}

                      constructor

                      constructor(adapter?: Partial<MDCSwitchAdapter>);

                        property cssClasses

                        static readonly cssClasses: { CHECKED: string; DISABLED: string };
                        • The CSS classes used by the switch.

                        property defaultAdapter

                        static readonly defaultAdapter: MDCSwitchAdapter;
                        • The default Adapter for the switch.

                        property strings

                        static readonly strings: {
                        ARIA_CHECKED_ATTR: string;
                        NATIVE_CONTROL_SELECTOR: string;
                        RIPPLE_SURFACE_SELECTOR: string;
                        };
                        • The string constants used by the switch.

                        method handleChange

                        handleChange: (evt: Event) => void;
                        • Handles the change event for the switch native control.

                        method setChecked

                        setChecked: (checked: boolean) => void;
                        • Sets the checked state of the switch.

                        method setDisabled

                        setDisabled: (disabled: boolean) => void;
                        • Sets the disabled state of the switch.

                        interface MDCSwitchAdapter

                        interface MDCSwitchAdapter {}
                        • 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;
                        • Adds a CSS class to the root element.

                        method removeClass

                        removeClass: (className: string) => void;
                        • Removes a CSS class from the root element.

                        method setNativeControlAttr

                        setNativeControlAttr: (attr: string, value: string) => void;
                        • Sets an attribute value of the native HTML control underlying the switch.

                        method setNativeControlChecked

                        setNativeControlChecked: (checked: boolean) => void;
                        • Sets checked state of the native HTML control underlying the switch.

                        method setNativeControlDisabled

                        setNativeControlDisabled: (disabled: boolean) => void;
                        • Sets the disabled state of the native HTML control underlying the switch.

                        namespace @material/switch/adapter

                        module '@material/switch/adapter' {}

                          interface MDCSwitchAdapter

                          interface MDCSwitchAdapter {}
                          • 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;
                          • Adds a CSS class to the root element.

                          method removeClass

                          removeClass: (className: string) => void;
                          • Removes a CSS class from the root element.

                          method setNativeControlAttr

                          setNativeControlAttr: (attr: string, value: string) => void;
                          • Sets an attribute value of the native HTML control underlying the switch.

                          method setNativeControlChecked

                          setNativeControlChecked: (checked: boolean) => void;
                          • Sets checked state of the native HTML control underlying the switch.

                          method setNativeControlDisabled

                          setNativeControlDisabled: (disabled: boolean) => void;
                          • Sets the disabled state of the native HTML control underlying the switch.

                          namespace @material/switch/component

                          module '@material/switch/component' {}

                            class MDCSwitch

                            class MDCSwitch
                            extends MDCComponent<MDCSwitchFoundation>
                            implements MDCRippleCapableSurface {}

                              property checked

                              checked: boolean;

                                property disabled

                                disabled: boolean;

                                  property ripple

                                  readonly ripple: any;

                                    method attachTo

                                    static attachTo: (root: HTMLElement) => MDCSwitch;

                                      method destroy

                                      destroy: () => void;

                                        method getDefaultFoundation

                                        getDefaultFoundation: () => MDCSwitchFoundation;

                                          method initialSyncWithDOM

                                          initialSyncWithDOM: () => void;

                                            namespace @material/switch/constants

                                            module '@material/switch/constants' {}

                                              variable cssClasses

                                              const cssClasses: { CHECKED: string; DISABLED: string };
                                              • CSS classes used by the switch.

                                              variable strings

                                              const strings: {
                                              ARIA_CHECKED_ATTR: string;
                                              NATIVE_CONTROL_SELECTOR: string;
                                              RIPPLE_SURFACE_SELECTOR: string;
                                              };
                                              • String constants used by the switch.

                                              namespace @material/switch/foundation

                                              module '@material/switch/foundation' {}

                                                class MDCSwitchFoundation

                                                class MDCSwitchFoundation extends MDCFoundation<MDCSwitchAdapter> {}

                                                  constructor

                                                  constructor(adapter?: Partial<MDCSwitchAdapter>);

                                                    property cssClasses

                                                    static readonly cssClasses: { CHECKED: string; DISABLED: string };
                                                    • The CSS classes used by the switch.

                                                    property defaultAdapter

                                                    static readonly defaultAdapter: MDCSwitchAdapter;
                                                    • The default Adapter for the switch.

                                                    property strings

                                                    static readonly strings: {
                                                    ARIA_CHECKED_ATTR: string;
                                                    NATIVE_CONTROL_SELECTOR: string;
                                                    RIPPLE_SURFACE_SELECTOR: string;
                                                    };
                                                    • The string constants used by the switch.

                                                    method handleChange

                                                    handleChange: (evt: Event) => void;
                                                    • Handles the change event for the switch native control.

                                                    method setChecked

                                                    setChecked: (checked: boolean) => void;
                                                    • Sets the checked state of the switch.

                                                    method setDisabled

                                                    setDisabled: (disabled: boolean) => void;
                                                    • Sets the disabled state of the switch.

                                                    Package Files (1)

                                                    Dependencies (10)

                                                    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/switch.

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