> 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.

# jsx-curly-brace-presence

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


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

export default defineConfig([
  reactPlugin.configs.recommended,
  {
    rules: {
      'react/jsx-curly-brace-presence': 'error',
    },
  },
]);
```

## Rule Details

Enforce curly braces or disallow unnecessary curly braces in JSX props and/or
children.

By default, the rule warns about unnecessary curly braces in both JSX props
and children. Prop values that are JSX elements are ignored by default.

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

```jsx
<App prop={'foo'} attr={"bar"}>{'Hello world'}</App>;
```

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

```jsx
<App prop="foo" attr="bar">Hello world</App>;
```

Examples of **incorrect** code for this rule with `{ "props": "always", "children": "always" }`:

```json
{ "react/jsx-curly-brace-presence": ["error", { "props": "always", "children": "always" }] }
```

```jsx
<App>Hello world</App>;
<App prop='Hello world'>{'Hello world'}</App>;
```

Examples of **incorrect** code for this rule with `{ "props": "always", "children": "always", "propElementValues": "always" }`:

```json
{ "react/jsx-curly-brace-presence": ["error", { "props": "always", "children": "always", "propElementValues": "always" }] }
```

```jsx
<App prop=<div /> />;
```

Examples of **incorrect** code for this rule with `{ "props": "never", "children": "never", "propElementValues": "never" }`:

```json
{ "react/jsx-curly-brace-presence": ["error", { "props": "never", "children": "never", "propElementValues": "never" }] }
```

```jsx
<App prop={<div />} />;
```

## Options

The rule accepts either an options object or a single string shorthand:

```json
{ "react/jsx-curly-brace-presence": ["error", { "props": "never", "children": "never", "propElementValues": "ignore" }] }
```

```json
{ "react/jsx-curly-brace-presence": ["error", "never"] }
```

Each of `props`, `children`, and `propElementValues` accepts:

- `"always"` — enforce curly braces.
- `"never"` — disallow unnecessary curly braces.
- `"ignore"` — disable the check.

The string shorthand sets `props` and `children` to the given value;
`propElementValues` stays at its default of `"ignore"`.

## Original Documentation

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