Skip to main content


Takes an StyleX style or array of StyleX styles, and returns a props object. Values can also be null, undefined, or false.

The return value should be onto an element to apply the styles directly.

For Solid, Svelte, Qwik, Vue, & others: stylex.attrs

For frameworks that expect class instead of className, use style.attrs instead. The usage is otherwise identical to stylex.props.

function props(styles: StyleXStyles | StyleXStyles[]): {
className: string;
style: {[key: string]: string};

Example use:

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

const styles = stylex.create({
root: {
backgroundColor: 'red',
padding: '1rem',
paddingInlineStart: '2rem',
conditional: {
backgroundColor: 'blue',
dynamic: (opacity) => ({

condition && styles.conditional,,