goober, css-in-js at the cost of peanuts

css-in-js at the cost of peanuts.

The styled API in 1.2 KB gzipped. Works with React, Preact, Fre and plain JavaScript.

npm i goober

Pay in peanuts.

One peanut is 100 bytes. Each jar holds the gzipped cost of one styled button. goober fits in a handful. Click a jar to shake it.

And it renders faster

One lap is one renderToString. Laps per second are drawn to scale.

goober
210k/s
emotion
93k/s
styled-components
32k/s
goober1,275 B13 peanuts
emotion11,236 B112 peanuts
styled-components11,092 B111 peanuts

Measured Nov 28, 2026: 2.2.0, @emotion/styled 11.14.1, styled-components 6.7.0. esbuild, minified, gzip level 9, react external. SSR is the median of five runs on one laptop. Reproduce it from website/measure.

Edit it. It's real.

The button is styled by the goober running on this page. Change the css and it updates.

const Button = styled('button')`
`;
Class ..., generated at runtime.This preview runs the same rules through css().

The API you already know.

Built on the shoulders of emotion and styled-components, so the shapes are familiar. as, forwardRef, theming and vendor prefixing are in the box.

styled

Components with props-driven styles. Pass a tag, or any component that takes a className.

import { styled } from 'goober';

const Button = styled('button')`
    background: royalblue;
    color: white;

    &:hover {
        background: crimson;
    }
`;

// Styles can read props
const Dot = styled('span')((props) => ({
    opacity: props.dim ? 0.4 : 1
}));

setup

Run it once, before the first styled call. goober never imports your framework.

import { setup } from 'goober';
import { createElement } from 'react';

// Preact: setup(h)
setup(createElement);

css

A class name, with no framework at all.

import { css } from 'goober';

const card = css`
    border-radius: 12px;
    padding: 1rem;
`;

el.classList.add(card);

keyframes

Declare once, interpolate anywhere.

import { styled, keyframes } from 'goober';

const spin = keyframes`
    to {
        transform: rotate(360deg);
    }
`;

const Wheel = styled('div')`
    animation: ${spin} 1s linear infinite;
`;

extractCss

Critical css on the server. Hydration picks it up by id.

import { extractCss } from 'goober';

const html = renderToString(<App />);

const page =
    '<style id="_goober">' +
    extractCss() +
    '</style>' +
    html;

Your agent can use goober too.

Coding agents guess at css-in-js APIs and forget to call setup. Give them the docs as plain text, a skill, and a note in your project instructions.

  1. Point it at the docs

    Add goober to this project. Read https://goober.rocks/llms.txt first.
  2. Install the skill

    npx skills add cristianbote/goober
  3. Pin it in AGENTS.md or CLAUDE.md

    ## Styling
    Use goober for css-in-js. Docs for agents: https://goober.rocks/llms.txt
    Call setup(pragma) once in the entry file, before any styled() call.

The Great Shave Off

Remove bytes from goober's minified, gzipped output and get paid $1 for every byte.

Join the challenge

Take goober for a spin.

npm i goober
Read the docs