unocss / unocss

The instant on-demand atomic CSS engine.

Home Page:https://unocss.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`hidden` does not work for React components in Astro with Attributify preset

TheJiahao opened this issue · comments

UnoCSS version

0.60.4

Describe the bug

hidden (from Wind preset) does not work as attribute inside a React component in Astro. It works for imported Astro components.

All previous versions since 0.51.0 have the same issue. Earlier versions cannot start Astro server with the same config.

Reproduction

Minimal reproduction, https://stackblitz.com/edit/withastro-astro-7xnewp?file=src%2Fpages%2Findex.astro

  1. Load React and UnoCSS integrations in astro.config.ts
  2. Load presets Wind and Attributify in uno.config.ts
  3. Add un-hidden to any component inside a React component, (hidden conflicts with HTML attribute).
  4. Import and use the React component in Astro page file
  5. Start Astro server with astro dev or astro build && astro preview
  6. See the component not hidden, no un-hidden attributes exist produced HTML.

System Info

Astro 4.9.2, React 18.3.1

Validations

Workaround

Add hidden to classes.