# @solid-primitives/styles

> Collection of reactive primitives focused on styles.

Latest version **0.1.4** (published 2026-07-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install @solid-primitives/styles
pnpm add @solid-primitives/styles
yarn add @solid-primitives/styles
bun add @solid-primitives/styles
```

## Health

**Score 70/100 (B)** — status: active.

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

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.1.4 |
| Published | 2026-07-04 |
| First published | 2022-10-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Dependencies | 2 |
| Unpacked size | 8.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1558 |
| Author | Damian Tarnawski |
| Maintainers | davedbase, lexlohr, thetarnav. |
| Keywords | solid, primitives, styles, css |

## Links

- npm: https://www.npmjs.com/package/@solid-primitives/styles
- Repository: https://github.com/solidjs-community/solid-primitives
- Homepage: https://primitives.solidjs.community/package/styles
- Issues: https://github.com/solidjs-community/solid-primitives/issues
- npm.io page: https://npm.io/package/@solid-primitives/styles

## Dependencies (2)

- [@solid-primitives/utils](https://npm.io/package/@solid-primitives/utils.md) ^6.4.1
- [@solid-primitives/rootless](https://npm.io/package/@solid-primitives/rootless.md) ^1.5.4

## Alternatives

- [style-dictionary](https://npm.io/package/style-dictionary.md) — 2.0M weekly downloads
- [postcss-merge-idents](https://npm.io/package/postcss-merge-idents.md) — 1.7M weekly downloads
- [@fontsource/noto-sans](https://npm.io/package/@fontsource/noto-sans.md) — 93.0K weekly downloads
- [uglifycss](https://npm.io/package/uglifycss.md) — 71.6K weekly downloads
- [mat4-interpolate](https://npm.io/package/mat4-interpolate.md) — 23.3K weekly downloads

## Recent versions

- 0.1.4 (latest) — 2026-07-04
- 1.0.0-next.2 (next) — 2026-08-12
- 0.0.105-beta.0 (beta) — 2023-03-03
- 1.0.0-next.1 — 2026-07-18
- 1.0.0-next.0 — 2026-06-26
- 0.1.3 — 2026-02-24
- 0.1.2 — 2025-06-29
- 0.1.1 — 2025-04-27
- 0.1.0 — 2025-01-22
- 0.0.114 — 2024-03-05
- 0.0.113 — 2024-02-28
- 0.0.112 — 2024-01-16
- 0.0.111 — 2023-08-04
- 0.0.110 — 2023-05-19
- 0.0.109 — 2023-05-07
- … 9 more at https://npm.io/package/@solid-primitives/styles/versions

## README

<p>
  <img width="100%" src="https://assets.solidjs.com/banner?type=Primitives&background=tiles&project=styles" alt="Solid Primitives styles">
</p>

# @solid-primitives/styles

[![size](https://img.shields.io/bundlephobia/minzip/@solid-primitives/styles?style=for-the-badge&label=size)](https://bundlephobia.com/package/@solid-primitives/styles)
[![version](https://img.shields.io/npm/v/@solid-primitives/styles?style=for-the-badge)](https://www.npmjs.com/package/@solid-primitives/styles)
[![stage](https://img.shields.io/endpoint?style=for-the-badge&url=https%3A%2F%2Fraw.githubusercontent.com%2Fsolidjs-community%2Fsolid-primitives%2Fmain%2Fassets%2Fbadges%2Fstage-0.json)](https://github.com/solidjs-community/solid-primitives#contribution-process)

Collection of reactive primitives focused on styles.

- [`createRemSize`](#createremsize) - Create a reactive signal of css `rem` size in pixels.

## Installation

```bash
npm install @solid-primitives/styles
# or
yarn add @solid-primitives/styles
# or
pnpm add @solid-primitives/styles
```

## `createRemSize`

Creates a reactive signal with value of the current rem size in pixels, and tracks it's changes.

### How to use it

It takes no arguments and returns a number signal.

```ts
import { createRemSize } from "@solid-primitives/styles";

const remSize = createRemSize();
console.log(remSize()); // 16

createEffect(() => {
  console.log(remSize()); // remSize value will be logged on every change to the root font size
});
```

### `useRemSize`

This primitive provides a [singleton root](https://github.com/solidjs-community/solid-primitives/tree/main/packages/rootless#createSingletonRoot) variant that will reuse signals, HTML elements and the ResizeObserver instance across all dependents that use it.

It's behavior is the same as [`createRemSize`](#createremsize).

```ts
import { useRemSize } from "@solid-primitives/styles";

const remSize = useRemSize();
console.log(remSize()); // 16
```

### Server fallback

When using this primitive on the server, it will return a signal with a value of `16` by default. You can override this value by calling the `setServerRemSize` helper with a new value, before calling `createRemSize` or `useRemSize`.

```ts
import { setServerRemSize, createRemSize } from "@solid-primitives/styles";

setServerRemSize(10);

const remSize = createRemSize();
console.log(remSize()); // 10 instead of 16 (only on the server!)
```

## Demo

TODO

## Changelog

See [CHANGELOG.md](./CHANGELOG.md)

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