Use With
Setting up Twind for seamless integration in a Remix project.
- 📝 Inspect the example
- 📓 Consult the API reference
- 📜 Read the changelog
The @twind/with-remix
package is deprecated in favor of the @twind/with-react
package which is used throughout this guide.
🤝 Compatibility
@twind/with-react | remix |
---|---|
>=1.0.0 <2 | 1.x |
📦 Installation
This guide uses renderToString to generate server-side rendered styles. For an example with React v18 and renderToPipeableStream take a look at examples/with-remix_react-v18.
-
Install from npm
@twind/core
and@twind/with-react
are available on npm and need to be installed together. -
Define the configuration
Using an extra file,
twind.config.js
, allows some tools like IntelliSense to find your configuration. -
Load Twind in the root route
install
creates and registers a twind instance that will generate the styles. This allows third-party packages to importtw
from the twind package and get the same instance. -
Enable Twind in the server entry
Enable server-side rendering of all the styles that are used within the HTML and sending them to the client.
-
Optional: Install and configure the recommended presets
@twind/preset-autoprefix
and@twind/preset-tailwind
.Install the presets
All presets are available on npm.
Configure the presets
Each preset must be added to the
presets
array in the configuration. -
Start using Twind in your remix components
Start using Twind classes to style your content.