# void-dom-elements-no-children

Rule `react/void-dom-elements-no-children`. Disallow void DOM elements (e.g. `<img />`, `<br />`) from receiving children

- Source: react
- Technologies: React
- Kind: correctness
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 34M weekly downloads of presets that enable it
- Trend: +89.5% last quarter
- Rank: #457 by reach, #295 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `react/void-dom-elements-no-children` | no | no | package `eslint-plugin-react` | [docs](https://github.com/jsx-eslint/eslint-plugin-react/tree/master/docs/rules/void-dom-elements-no-children.md) |
| Oxlint | `react/void-dom-elements-no-children` | no | no | plugin `react`, category correctness | [docs](https://oxc.rs/docs/guide/usage/linter/rules/react/void-dom-elements-no-children.html) |
| Biome | `correctness/noVoidElementsWithChildren` | yes | unsafe | group correctness, since 1.0.0 | [docs](https://biomejs.dev/linter/rules/no-void-elements-with-children/) |

## Code examples

### Incorrect: the rule reports this

```jsx
<br>Children</br>
<br children='Children' />
<br dangerouslySetInnerHTML={{ __html: 'HTML' }} />
React.createElement('br', undefined, 'Children')
React.createElement('br', { children: 'Children' })
React.createElement('br', { dangerouslySetInnerHTML: { __html: 'HTML' } })
```

### Correct: the rule accepts this

```jsx
<div>Children</div>
<div children='Children' />
<div dangerouslySetInnerHTML={{ __html: 'HTML' }} />
React.createElement('div', undefined, 'Children')
React.createElement('div', { children: 'Children' })
React.createElement('div', { dangerouslySetInnerHTML: { __html: 'HTML' } })
```

Examples from the ESLint documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
import react from "eslint-plugin-react";

export default [
  {
    plugins: { react },
    rules: {
      "react/void-dom-elements-no-children": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "plugins": [
    "react"
  ],
  "rules": {
    "react/void-dom-elements-no-children": "error"
  }
}
```

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "correctness": {
        "noVoidElementsWithChildren": "error"
      }
    }
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Biome recommended](https://lintradar.dev/presets/biome-recommended.md) | Biome | `@biomejs/biome` | 491 | 28.5M | +106.8% |
| [Airbnb](https://lintradar.dev/presets/airbnb.md) | ESLint | `eslint-config-airbnb` | 346 | 3.4M | +2.3% |
| [Ultracite for Biome](https://lintradar.dev/presets/ultracite-biome.md) | Biome | `ultracite` | 616 | 2.1M | +151.7% |
| [Alloy](https://lintradar.dev/presets/alloy.md) | ESLint | `eslint-config-alloy` | 166 | 31.4K | +32.4% |

## Related rules

- [react/jsx-no-useless-fragment](https://lintradar.dev/rules/react/jsx-no-useless-fragment.md): Disallow unnecessary fragments
- [react/button-has-type](https://lintradar.dev/rules/react/button-has-type.md): Disallow usage of `button` elements without an explicit `type` attribute
- [react/no-array-index-key](https://lintradar.dev/rules/react/no-array-index-key.md): Disallow usage of Array index in keys
- [react/no-danger](https://lintradar.dev/rules/react/no-danger.md): Disallow usage of dangerous JSX properties
- [react/no-object-type-as-default-prop](https://lintradar.dev/rules/react/no-object-type-as-default-prop.md): Disallow usage of referential-type variables as default param in functional component
- [react/prop-types](https://lintradar.dev/rules/react/prop-types.md): Disallow missing props validation in a React component definition

---

Web page: https://lintradar.dev/rules/react/void-dom-elements-no-children. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
