🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

teleport-css

Package Overview
Dependencies
Maintainers
0
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

teleport-css

A simple yet powerful CSS-in-JS library for React 19.

latest
Source
npmnpm
Version
0.9.0
Version published
Maintainers
0
Created
Source

npm version

Teleport CSS

A simple yet powerful CSS-in-JS library for React 19.

Features

  • Plug-and-Play: Works out of the box—no need for bundler or PostCSS configuration.
  • React Server Components (RSC) Support: Seamlessly integrates with React Server Components.
  • Streaming Support: Compatible with React's streaming rendering.
  • Atomic CSS, Minus the Pitfalls: Achieve atomic CSS with ease, avoiding common issues [1][2].
  • Optimized for Component Libraries: Specifically designed to streamline the creation of reusable component libraries.
  • Lightweight: 2.1kB minified and gzipped. Check bundle size on Bundlephobia.

Prerequisites

  • React 19

Installation

npm i teleport-css

Usage

import { create } from 'teleport-css';
// Use your preferred hash algorithm
import fnv1a from '@sindresorhus/fnv1a';

function hashFn(value: string) {
  return fnv1a(value, { size: 64 }).toString(36).slice(0, 8);
}

const { styled, keyframes, cloneAs } = create({
  hashFn,
  context: {
    breakpoints: {
      md: '768px',
    },
  },
});

const animation = keyframes((context) => ({
  from: { transform: 'rotate(0deg)' },
  to: { transform: 'rotate(360deg)' },
}));

const Button = styled('button', (context) => ({
  animation: `${animation} 1s ease infinite`,
  backgroundColor: 'pink',
  [`@media (width >= ${context.breakpoints.md})`]: {
    backgroundColor: 'gold',
  },
}));

const ButtonAsLink = cloneAs(Button, 'a');

function App() {
  return (
    <>
      <Button
        type="button"
        css={(context) => ({
          '&:hover': {
            backgroundColor: 'lemonchiffon',
          },
        })}
      >
        Test
      </Button>
      <ButtonAsLink href="/">Home</ButtonAsLink>
    </>
  );
}

Documentation

See docs.

Browser support

Browsers support CSS Nesting (Baseline 2023).

License

MIT

Keywords

react

FAQs

Package last updated on 07 Mar 2025

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