# emotion-solid

> Emotion JS support for Solid JS projects.

Latest version **2.1.0** (published 2023-10-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install emotion-solid
pnpm add emotion-solid
yarn add emotion-solid
bun add emotion-solid
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.0 |
| Published | 2023-10-05 |
| First published | 2021-06-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 4.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 46 |
| Author | Ari Seyhun |
| Maintainers | acidic9 |

## Links

- npm: https://www.npmjs.com/package/emotion-solid
- Repository: https://github.com/Acidic9/emotion-solid
- Homepage: https://github.com/Acidic9/emotion-solid#readme
- Issues: https://github.com/Acidic9/emotion-solid/issues
- npm.io page: https://npm.io/package/emotion-solid

## Dependencies (4)

- [@emotion/cache](https://npm.io/package/@emotion/cache.md) ^11.4.0
- [@emotion/utils](https://npm.io/package/@emotion/utils.md) ^1.0.0
- [@emotion/serialize](https://npm.io/package/@emotion/serialize.md) ^1.0.2
- [@emotion/is-prop-valid](https://npm.io/package/@emotion/is-prop-valid.md) ^1.1.0

## Recent versions

- 2.1.0 (latest) — 2023-10-05
- 1.1.1 — 2021-07-04
- 1.1.0 — 2021-06-30
- 1.0.0 — 2021-06-29

## README

<h1 align="center">Emotion Solid</h1>

<div align="center">
  Emotion JS support for Solid JS.
</div>

<br>

## Installation

```bash
npm i emotion-solid
# or
yarn add emotion-solid
```

## Usage

```ts
import { styled } from 'emotion-solid'

export type ButtonProps = {
  block?: boolean
}

const StyledButton = styled('button')<ButtonProps>(
  {
    display: 'inline-block',
    padding: '8px 6px',
    borderRadius: 8,
  },
  ({ block }) =>
    block && {
      display: 'block',
      width: '100%',
    }
)

const Button: Component<ButtonProps> = (props) => {
  return <StyledButton {...props}>{props.children}</StyledButton>
}

export default Button
```

```tsx
import { render } from 'solid-js/web'
import Button from './Button'

function App() {
  return <Button block>Click Me</Button>
}

render(() => <App />, document.getElementById('app'))
```

## Themes

You can pass theme to all your styled components with `ThemeProvider`.

```ts
import type { Component } from 'solid-js/web'
import { ThemeProvider, styled } from 'emotion-solid'

const StyledButton = styled('button')(
  ({ theme }) =>
    {
      backgroundColor: theme.color,
      width: '100%',
    }
)

const App: Component = () => {
  const [theme, setTheme] = createSignal({color: 'green'});
  return <ThemeProvider theme={theme}><Button>Click Me</Button></ThemeProvider>
}
```

Note that you have to pass accessor function that returns the theme object
instead of just giving the theme object itself.

## Contributing 🙌

Contributions are more than welcome. If you see any changes fit, go ahead and open an issue or PR.

---

Any support is a huge motivation, thank you very much!

<a href="https://www.buymeacoffee.com/ariseyhun" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-orange.png" alt="Buy Me A Coffee" height="32" width="140"></a>

---
_Source: https://npm.io/package/emotion-solid · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
