Skip to main content

classFor

Transforms all "class" and "for" props to "className" and "htmlFor".

// Use `class` and `for` instead of `className` and `htmlFor`

export default function App() {
  return (
    <button class="bg-blue-500 text-white">
      Hello
    </button>
  )
}

Installation

npm install react-beyond @react-beyond/classfor

Usage

import { Beyond } from 'react-beyond'
import { classFor } from '@react-beyond/classfor'

<Beyond features={[classFor(<options>)]}>
  <App />
</Beyond>

Options

  • id - The id of the feature HOC. Defaults to "classFor".
  • onlyDom - Whether to replace the class prop on components too, not just on DOM elements. It never replaces the for prop on components. Defaults to false.
  • clsx - Whether to accept clsx syntax.