# @unocss/transformer-attributify-jsx

> Support valueless attributify in JSX/TSX.

Latest version **66.10.5** (published 2026-09-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install @unocss/transformer-attributify-jsx
pnpm add @unocss/transformer-attributify-jsx
yarn add @unocss/transformer-attributify-jsx
bun add @unocss/transformer-attributify-jsx
```

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; popular repo.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 66.10.5 |
| Published | 2026-09-16 |
| First published | 2022-07-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Dependencies | 3 |
| Unpacked size | 10.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 18964 |
| Author | Anthony Fu <anthonyfu117@hotmail.com> |
| Maintainers | antfu, unocss-bot, zyyv |
| Keywords | unocss, unocss-transformer |

## Links

- npm: https://www.npmjs.com/package/@unocss/transformer-attributify-jsx
- Repository: https://github.com/unocss/unocss
- Homepage: https://unocss.dev
- Issues: https://github.com/unocss/unocss/issues
- Funding: https://github.com/sponsors/antfu
- npm.io page: https://npm.io/package/@unocss/transformer-attributify-jsx

## Dependencies (3)

- [oxc-parser](https://npm.io/package/oxc-parser.md) ^0.150.0
- [oxc-walker](https://npm.io/package/oxc-walker.md) ^0.7.0
- [@unocss/core](https://npm.io/package/@unocss/core.md) 66.10.5

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 66.10.5 (latest) — 2026-09-16
- 66.10.4 — 2026-09-15
- 66.10.3 — 2026-09-15
- 66.10.2 — 2026-09-11
- 66.10.1 — 2026-09-09
- 66.10.0 — 2026-09-04
- 66.9.2 — 2026-09-02
- 66.9.1 — 2026-09-01
- 66.8.1 — 2026-08-21
- 66.8.0 — 2026-08-19
- 66.8.0-beta.1 — 2026-08-19
- 66.7.5 — 2026-07-07
- 66.7.4 — 2026-06-29
- 66.7.4-beta.1 — 2026-06-29
- 66.7.3 — 2026-06-26
- … 229 more at https://npm.io/package/@unocss/transformer-attributify-jsx/versions

## README

# @unocss/transformer-attributify-jsx

<!-- @unocss-ignore -->

Support [valueless attributify](https://github.com/unocss/unocss/tree/main/packages-presets/preset-attributify#valueless-attributify) in JSX/TSX.

```jsx
export function Component() {
  return (
    <div text-red text-center text-5xl animate-bounce>
      unocss
    </div>
  )
}
```

Will be transformed to:

```jsx
export function Component() {
  return (
    <div text-red="" text-center="" text-5xl="" animate-bounce="">
      unocss
    </div>
  )
}
```

<details>
<summary>Without this transformer</summary>

JSX by default will treat valueless attributes as boolean attributes.

```jsx
export function Component() {
  return (
    <div text-red={true} text-center={true} text-5xl={true} animate-bounce={true}>
      unocss
    </div>
  )
}
```

</details>

## Install

```bash
npm i -D @unocss/transformer-attributify-jsx
```

```ts
import transformerAttributifyJsx from '@unocss/transformer-attributify-jsx'
// uno.config.ts
import { defineConfig, presetAttributify } from 'unocss'

export default defineConfig({
  // ...
  presets: [
    // ...
    presetAttributify()
  ],
  transformers: [
    transformerAttributifyJsx(), // <--
  ],
})
```

## Caveats

> ⚠️ The rules are almost the same as those of `preset-attributify`, but there are several precautions

```html
<div translate-x-100% />
<!-- cannot end with `%` -->

<div translate-x-[100px] />
<!-- cannot contain `[` or `]` -->
```

Instead, you may want to use valued attributes instead:

```html
<div translate="x-100%" />

<div translate="x-[100px]" />
```

## Blocklist

This transformer will only transform attributes that are valid UnoCSS utilities.
You can also `blocklist` bypass some attributes from been transformed.

```js
transformerAttributifyJsx({
  blocklist: [/text-[a-zA-Z]*/, 'text-5xl']
})
```

```jsx
<div text-red text-center text-5xl animate-bounce>
  unocss
</div>
```

Will be compiled to:

```html
<div text-red text-center text-5xl animate-bounce="">unocss</div>
```

## Resolver

By default, the transformer uses the Oxc resolver and falls back to the regex resolver when Oxc cannot parse a file.
You can select a resolver for individual files directly in `include`:

```js
transformerAttributifyJsx({
  include: [
    { pattern: /\.mdx$/, resolver: 'regex' },
    { pattern: /\.[jt]sx$/, resolver: 'oxc' },
  ],
})
```

The first matching pattern is used. A rule with an explicit resolver does not fall back to another resolver when it fails.

## License

MIT License &copy; 2022-PRESENT [Anthony Fu](https://github.com/antfu)

---
_Source: https://npm.io/package/@unocss/transformer-attributify-jsx · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
