# forbid-elements

Rule `react/forbid-elements`. Disallow certain elements

- Source: react
- Technologies: React
- Kind: correctness
- Needs type information: no
- Autofix: no
- Reach: 2.1M weekly downloads of presets that enable it
- Trend: +151.7% last quarter
- Rank: #1507 by reach, #11 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `react/forbid-elements` | no | no | package `eslint-plugin-react` | [docs](https://github.com/jsx-eslint/eslint-plugin-react/tree/master/docs/rules/forbid-elements.md) |
| Oxlint | `react/forbid-elements` | no | no | plugin `react`, category restriction | [docs](https://oxc.rs/docs/guide/usage/linter/rules/react/forbid-elements.html) |
| Biome | `correctness/noRestrictedElements` | no | no | group correctness, since 2.0.0 | [docs](https://biomejs.dev/linter/rules/no-restricted-elements/) |

## Code examples

### Incorrect: the rule reports this

```jsx
// [1, { "forbid": ["button"] }]
<button />
React.createElement('button');

// [1, { "forbid": ["Modal"] }]
<Modal />
React.createElement(Modal);

// [1, { "forbid": ["Namespaced.Element"] }]
<Namespaced.Element />
React.createElement(Namespaced.Element);

// [1, { "forbid": [{ "element": "button", "message": "use <Button> instead" }, "input"] }]
<div><button /><input /></div>
React.createElement('div', {}, React.createElement('button', {}, React.createElement('input')));
```

### Correct: the rule accepts this

```jsx
// [1, { "forbid": ["button"] }]
<Button />

// [1, { "forbid": [{ "element": "button" }] }]
<Button />
```

Examples from the ESLint documentation.

## Enable it

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

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

export default [
  {
    plugins: { react },
    rules: {
      "react/forbid-elements": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "plugins": [
    "react"
  ],
  "rules": {
    "react/forbid-elements": "error"
  }
}
```

### Biome: `biome.json`

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

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Ultracite for Biome](https://lintradar.dev/presets/ultracite-biome.md) | Biome | `ultracite` | 616 | 2.1M | +151.7% |

## Related rules

- [react/jsx-props-no-spread-multi](https://lintradar.dev/rules/react/jsx-props-no-spread-multi.md): Disallow JSX prop spreading the same identifier multiple times
- [react/iframe-missing-sandbox](https://lintradar.dev/rules/react/iframe-missing-sandbox.md): Enforce sandbox attribute on iframe elements
- [react/sort-comp](https://lintradar.dev/rules/react/sort-comp.md): Enforce component methods order
- [react/require-default-props](https://lintradar.dev/rules/react/require-default-props.md): Enforce a defaultProps definition for every prop that is not a required prop
- [react/prefer-stateless-function](https://lintradar.dev/rules/react/prefer-stateless-function.md): Enforce stateless components to be written as a pure function
- [react/prefer-exact-props](https://lintradar.dev/rules/react/prefer-exact-props.md): Prefer exact proptype definitions

---

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