New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@solid-primitives/styles

Package Overview
Dependencies
Maintainers
3
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@solid-primitives/styles

Collection of reactive primitives focused on styles.

  • 0.0.111
  • Source
  • npm
  • Socket score

Version published
Maintainers
3
Created
Source

Solid Primitives styles

@solid-primitives/styles

turborepo size version stage

Collection of reactive primitives focused on styles.

Installation

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.

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 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.

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.

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

Keywords

FAQs

Package last updated on 04 Aug 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc