Skip to content

Function: setStyleProps()

ts
function setStyleProps<T>(element, props): void;

Sets the style properties of an HTML element.

Type Parameters

Type Parameter
T extends HTMLElement

Parameters

ParameterTypeDescription
elementT | nullThe element to set style properties on.
propsPartial<{ [key: string]: string; }>The style properties to set, in the form of an object of key-value pairs.

Returns

void

void

Example

ts
const el = document.getElementById('myElement')
setStyleProps(el, { color: 'red', fontSize: '14px' })

Since

1.0.0

Released under the MIT License.