made for Nordcraft

Root context

The root context component is a required wrapper for applications using ZenoCore 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 ZenoCore components.

Architecture

zcore-root-context
Slot: default Place your app or page here.

Reference

  • Root context

    • Formulas

      • 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.

      • 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.

    • Workflows

      • 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.

      • 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.