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

https://github.com/streamich/virtual-css

💄 Virtual CSS for virtual DOM libraries
https://github.com/streamich/virtual-css

Last synced: 11 months ago
JSON representation

💄 Virtual CSS for virtual DOM libraries

Awesome Lists containing this project

README

          

# virtual-css

Virtual CSS renderer. Renders only CSS declaration that changed.

```shell
npm i virtual-css
```

- Inline CSS with pseudo-selectors and media queries

## Usage

As React hook:

```js
import {useCss} from 'virtual-css';

const Demo = () => {
const className = useCss({
color: 'tomato',
'&:hover': {
color: 'orange',
},
});

return

Hover me!
;
};
```

As styled blocks:

```js
import {Box, Text} from 'virtual-css';

const myCss = {
color: 'tomato',
'&:hover': {
color: 'orange',
},
};

Hover me!
Hover me!
```

As inline JSX:

```js
/** @jsx jsx */
import {jsx} from 'virtual-css';

const myCss = {
color: 'tomato',
'&:hover': {
color: 'orange',
},
};

Hover me!

```

If you are using TypeScript, include this type override:

```ts
declare module 'react' {
interface DOMAttributes {
css?: any;
}
}
```

## License

[Unlicense](LICENSE) — public domain.