.setStyle(propertyOrMap, value?)
Available on: InDom, InDomArray

Sets one or more CSS properties to the underlying element(s). Dash-case names are auto-converted to camel-case.

Parameters:
propertyOrMap {string} - Property name (dash-case or camel-case) or object map { prop: value, ... } for bulk assignment
value {string} - Value to assign (when first arg is a string)

Returns: {InDom | InDomArray} -  this for chaining

Throws:
Error - If the underlying element(s) has been removed
TypeError - If a single argument is not an object

Examples:
const div = $n('<div></div>');
$1('body').append(div);

// single property
div.setStyle('background-color', 'blue');
console.log(div.getStyle('background-color'));
// rgb(0, 0, 255)

// bulk assignment + multi-read
div.setStyle({ width: '100px', height: '50px', fontSize: '16px' });
console.log(div.getStyle('width', 'height', 'font-size'));
// {width: '100px', height: '50px', 'font-size': '16px'}

// apply to collection
$a('.example>div').setStyle({ color: 'blue', 'font-size': '15px' });

// inspect every computed property
const styles = $1('.example>div').getStyle();
console.log([styles.color, styles.fontSize]);
// ['rgb(0, 0, 255)', '15px']
Modern DOM Power
for TypeScript, ESM & Plain JS
3.8KB JavaScript library that simplifies DOM manipulation
with a clean, chainable API for events, data, inputs harvesting, and more.
Automatic Cleanup,
Leak-Proof by Design
Events and state are cleared when elements leave the DOM,
even if removal happens outside InDom.
Cleaner Code,
Better Ergonomics
Get the InDom object directly in callbacks.
One element, one instance.
Works With Your Existing Stack
Use InDom on its own or alongside any library or framework,
its architecture ensures a seamless integration.