Function toCSSProperty

  • Converts any string, number, or array of either type to a valid CSS property.

    Throws

    Invalid value provided.

    Parameters

    • value: string | number | (string | number)[]

      The value to convert. If it is a number, it will be suffixed with the provided unit. If it is an array, the returned CSS property will be a comma delimited string of all the values.

    • Optional unit: string

      The unit to append to number values.

    Returns string

    A valid CSS property.