An open API service indexing awesome lists of open source software.

https://github.com/idered/twix

Style React components with TailwindCSS
https://github.com/idered/twix

Last synced: about 1 year ago
JSON representation

Style React components with TailwindCSS

Awesome Lists containing this project

README

          

# Twix

![](./screenshot.png)


Style React components with TailwindCSS




Edit tailwindcss-radix-ui



twitter

## Install

```sh
npm i @idered/twix
```

To get IntelliSense working, add this to your Visual Studio Config:

```json
"tailwindCSS.experimental.classRegex": [
"twix\\([\\s\\S]*?'([^']*)'\\s?\\)",
"twix\\([\\s\\S]*?\"([^\"]*)\"\\s?\\)",
"twix\\([\\s\\S]*?`([^`]*)`\\s?\\)"
]
```

## Usage

```tsx
// components/checkbox.tsx
import { twix } from "@idered/twix";
import * as Checkbox from "@radix-ui/react-checkbox";

export const Root = twix(
Checkbox.Root,
"border border-slate-300 hover:border-slate-500 rounded w-8 h-8 flex items-center justify-center aria-checked:border-blue-500"
);

export const Indicator = twix(Checkbox.Indicator, "text-indigo-500");
```

```tsx
// app.tsx
import * as Checkbox from "./components/checkbox.tsx";
import { CheckIcon } from "@radix-ui/react-icons";

export default () => {
return (








);
};
```

## Styling based on state

Use [ARIA states](https://tailwindcss.com/docs/hover-focus-and-other-states#aria-states).