nishiki

Getting started

Install

One package holds both the runtime and the compiler:

pnpm add nishiki
npm install nishiki
yarn add nishiki
bun add nishiki

It needs React 19.

Set the JSX import source

Host elements accept a css prop once JSX is compiled with the library's runtime:

// tsconfig.json
{
  "compilerOptions": {
    "jsxImportSource": "nishiki",
  },
}

Set the same import source in your bundler's React or JSX transform; Bundler setup shows where for each one.

Style a component

import { styled } from "nishiki";

const Button = styled("button", {
  padding: "8px 16px",
  borderRadius: 6,
  background: "#1f6feb",
  color: "white",
  ":hover": { background: "#1158c7" },
  "@media (max-width: 600px)": { width: "100%" },
});

export function Counter({ count }: { count: number }) {
  return (
    <main css={{ display: "grid", gap: 12 }}>
      <p css={{ margin: 0, color: count % 2 ? "crimson" : "seagreen" }}>
        Clicked {count} {count === 1 ? "time" : "times"}
      </p>
      <Button css={{ justifySelf: "start" }}>Increment</Button>
    </main>
  );
}

This already works without a build step: the runtime compiles each style object as it renders and inserts its rules through React.

Add the compiler

The compiler is optional, but it moves the work of literal styles from render time to build time and can extract them into static CSS. With Vite, which needs vite and @vitejs/plugin-react installed:

// vite.config.ts
import react from "@vitejs/plugin-react";
import nishiki from "nishiki/unplugin/vite";

export default {
  plugins: [nishiki(), react({ jsxImportSource: "nishiki" })],
};

Other bundlers and Next.js are covered in Bundler setup.

Agent skill

The package ships an agent skill in skills/nishiki describing how to write styles that compile and how to debug them.