Provider

The Provider component is a required wrapper for applications using Spark Core components. It manages modal and overlay behaviors, handles scroll prevention, and provides utility formulas and workflows for proper component functionality.

Provides the required higher-order functionality for Spark Core components.

Architecture

sc-provider
Slot: default Place your app or page here.

Reference

  • Provider

    The root Provider component that manages application-wide behaviors and states. All application content should be placed within this component's default slot to ensure proper functionality of Spark Core components.

Context

  • isAndroid

    A utility formula that returns true when the application is running on an Android device. This can be used for platform-specific behavior implementation.

  • isIpad

    A utility formula that returns true when the application is running on an iPad device. This enables iPad-specific optimizations and behaviors.

  • isIphone

    A utility formula that returns true when the application is running on an iPhone device. This allows for iPhone-specific adaptations and behaviors.

  • openModals

    An array that contains the IDs of all currently opened modals that have been registered. This can be used to track and manage active modal instances within the application.

  • registerModal

    Registers a modal component with the Provider. When at least one modal is registered, the Provider automatically prevents page scrolling to maintain proper modal behavior and accessibility.

    • Parameters

      • id
        string
        / default: -

        A unique identifier for the modal being registered. This ID is required and must be unique across all registered modals.

  • scrollbarCorrection

    Returns the calculated padding value applied to the body element when the scroll is prevented. This correction ensures that content doesn't shift when the scrollbar is removed during modal display. In some cases, you want to have access to it.

  • unregisterModal

    Removes a modal's registration from the Provider. When no registered modals remain, page scrolling is automatically restored.

    • Parameters

      • id
        string
        / default: -

        The unique identifier of the modal to unregister. This must match the ID used during registration.

made for toddle