Forest.js Core Documentation - v1.2.3
    Preparing search index...

    Function addStyle

    • addStyle

      Type Parameters

      • R extends Partial<CSSStyleDeclaration>

        Style properties to apply.

      • S extends StoreMap<any> = StoreMap<any>

        StoreMap type when used reactively.

      • E extends HTMLElement = HTMLElement

        Element type (defaults to HTMLElement).

      Parameters

      • ...args: UtilityProps<R, S>

        Style properties or store and mapper function

      Returns Utility<E>

      Utility function for adding styles

      Applies CSS styles to an element. Supports reactive styles when using stores.

      const setColor = addStyle<HTMLDivElement, { color: string }>(
      { color: "red" }
      )(MyElement);