made for Nordcraft

Trigger button context

A context provider that enables custom buttons to function as accessible triggers for interactive components. Automatically manages ARIA attributes and state for components like dialogs, popovers, menus, dropdowns and more.

  • Create fully customized trigger buttons

  • Works with all trigger-based components

Reference

  • Trigger button context

    A context provider that supplies trigger button functionality and state management to child components. Enables custom buttons to control the visibility and behavior of associated interactive elements with proper ARIA attributes.

    • Formulas

      • ariaAutocomplete

        Indicates whether inputting text triggers display of predicted completions.

      • ariaControls

        References the ID of the element whose content or presence is controlled by the trigger button.

      • ariaExpanded

        Indicates whether the element controlled by the trigger is currently expanded or collapsed.

      • ariaHasPopup

        Indicates the type of popup element triggered by the button (menu, dialog, listbox, tree, grid or true).

      • ariaSelected

        Indicates the current selected state of the trigger button.

      • direction

        Specifies the reading direction of the trigger button content.

      • hasOpenClass

        Determines whether the trigger button receives an open state class when its associated component is visible.

      • hasTriggerContext

        Indicates whether the trigger button context is properly initialized and available.

      • isDisabled

        Controls whether the trigger button is disabled and cannot be interacted with.

      • popperId

        The unique identifier of the popup element controlled by the trigger button.

      • role

        Defines the ARIA role of the trigger button for accessibility purposes.

    • Workflows

      • updateTriggerButtonId

        Updates and registers the trigger button ID to enable opening functionality for associated components.

        Parameters
        • id
          string
          /
          default: -

          A unique identifier for the trigger button being registered. This ID is required and must be unique across all registered trigger buttons.