Skip to main content


Takes a map of style objects and returns an object of compiled StyleX styles. The compiled StyleX styles are a mapping of keys to class names.

function create<T extends {[key: string]: RawStyles | (...any[]) => RawStyles}>(
styles: T,
): {[Key in keyof T]: StyleXStyles<T[Key]>};

Example use:

import * as stylex from '@stylexjs/stylex';

const styles = stylex.create({
root: {
backgroundColor: 'red',
padding: '1rem',
paddingInlineStart: '2rem',
dynamic: (r, g, b) => ({
color: `rgb(${r}, ${g}, ${b})`,