Important
Recast set out to separate the theme layer from a component's internals, so one set of primitives could be styled differently in every project without duplicating code. That problem is now well covered by other tools, so the repository is being retired rather than left to drift.
Maintained alternatives:
| Instead of Recast | Use |
|---|---|
| Variants, slots, conditional styles, class conflict resolution | tailwind-variants |
| The smallest possible variant helper | class-variance-authority |
| Owning the component source in your own repo | shadcn/ui |
A note on versions: the last published release (@rpxl/recast@5.0.2, April 2025)
predates the recast.styles() API redesign that landed on main afterwards. That
redesign was never released to npm, so the code here and the code on npm differ.
Both packages are deprecated on npm. Everything remains available under the MIT license if you want to read it, fork it, or lift ideas from it.
Build components once. Use everywhere.
Recast is a fundamentally different approach to building React components to maximise reusability.
Recast is not just a collection of utilities; it is an approach/pattern to building truly reusable component primitives by abstracting the theme layer from the internal workings of a component.
The specific values that an Recast "primitive" can receive are not specified within the component, instead these are defined by wrapping the component with a styles definition that will form the theme API.
Recast is for any individual/team who wants to build a truly reusable component library that can be used across projects without duplicating code purely for the purposes of theming.
For full documentation, visit here.