CSS ↔ JS STYLE OBJECT

CSS strings and React style objects.

Convert a CSS style string to a JavaScript object for React, or back to CSS.

CSS input

JS object output

How this works

CSS property names are converted to camelCase for JavaScript, matching how React and the DOM style API expect them — background-color becomes backgroundColor. Vendor-prefixed properties follow the same convention browsers use: -webkit-transform becomes WebkitTransform, but -ms-transform becomes msTransform (lowercase), which is a well-known quirk of the -ms- prefix specifically.