> For AI agents: the complete documentation index is available at https://rslint.rs/llms.txt, the full documentation bundle is available at https://rslint.rs/llms-full.txt.

# style-prop-object

[Added in v0.3.0](https://github.com/web-infra-dev/rslint/releases/tag/v0.3.0)
## Configuration


```ts title=rslint.config.ts
import { defineConfig, reactPlugin } from '@rslint/core';

export default defineConfig([
  reactPlugin.configs.recommended,
  {
    rules: {
      'react/style-prop-object': 'error',
    },
  },
]);
```

## Rule Details

Enforce that the `style` prop value is an object. In React, the `style` prop expects a JavaScript object, not a CSS string.

Examples of **incorrect** code for this rule:

```jsx
<div style="color: red" />
<div style={"color: red"} />
```

Examples of **correct** code for this rule:

```jsx
<div style={{ color: 'red' }} />
<div style={styles} />
```

## Options

- `allow`: An array of component names that are allowed to use a non-object `style` prop.

## Limitations

- Detects `<pragma>.createElement(...)` where `<pragma>` defaults to `React` and can be overridden via `settings.react.pragma`. Destructured `createElement` (e.g. `import { createElement } from 'react'`) and `@jsx` comment pragmas are not supported.

## Original Documentation

- [eslint-plugin-react: style-prop-object](https://github.com/jsx-eslint/eslint-plugin-react/blob/v7.37.5/docs/rules/style-prop-object.md)
- [Source code](https://github.com/jsx-eslint/eslint-plugin-react/blob/v7.37.5/lib/rules/style-prop-object.js)
