0.16.0 • Published 6 months ago
@nayhoo/ui v0.16.0
@nayhoo/ui
A collection of React components, built with Radix Primitives, styled with vanilla-extract.
Installation
npm install @nayhoo/uiConfiguration
Next.js
npm install @vanilla-extract/next-plugin// next.config.ts
import { createVanillaExtractPlugin } from "@vanilla-extract/next-plugin";
import type { NextConfig } from "next";
const withVanillaExtract = createVanillaExtractPlugin();
const nextConfig: NextConfig = {
// https://vanilla-extract.style/documentation/integrations/next/
transpilePackages: ["@nayhoo/ui"],
};
export default withVanillaExtract(nextConfig);// src/app/provider.tsx
"use client";
import { ThemeProvider } from "@nayhoo/ui/providers";
import React from "react";
type AppProviderProps = {
children: React.ReactNode;
};
export const AppProvider = ({ children }: AppProviderProps) => {
return <ThemeProvider>{children}</ThemeProvider>;
};// src/app/layout.tsx
import "@nayhoo/ui/theme/index.css"; // REQUIRED
import type { Metadata } from "next";
import "./globals.css";
import { AppProvider } from "./provider";
export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
};
export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en" suppressHydrationWarning>
<body>
<AppProvider>{children}</AppProvider>
</body>
</html>
);
}// src/app/page.tsx
"use client";
import { Button } from "@nayhoo/ui/button";
export default function Home() {
return <Button />;
}Vite
npm install @vanilla-extract/vite-plugin// vite.config.ts
import { vanillaExtractPlugin } from "@vanilla-extract/vite-plugin";
import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";
// https://vite.dev/config/
export default defineConfig({
plugins: [react(), vanillaExtractPlugin()],
});// src/main.tsx
import "@nayhoo/ui/theme/index.css"; // REQUIRED
import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import App from "./App.tsx";
import "./index.css";
createRoot(document.getElementById("root")!).render(
<StrictMode>
<App />
</StrictMode>,
);// src/App.tsx
import { Button } from "@nayhoo/ui/button";
import { ThemeProvider } from "@nayhoo/ui/providers";
function App() {
return (
<ThemeProvider>
<Button onClick={() => alert("Hello!")}>Press me</Button>
</ThemeProvider>
);
}
export default App;0.16.0
6 months ago
0.15.0
6 months ago
0.14.1
6 months ago
0.14.0
6 months ago
0.13.0
6 months ago
0.12.1
7 months ago
0.11.1
7 months ago
0.11.0
7 months ago
0.10.2
8 months ago
0.10.1
8 months ago
0.10.0
8 months ago
0.9.6
8 months ago
0.9.5
8 months ago
0.9.4
8 months ago
0.9.3
8 months ago
0.9.2
9 months ago
0.9.1
9 months ago
0.9.0
9 months ago
0.8.0
9 months ago
0.7.0
9 months ago
0.6.1
9 months ago
0.6.0
9 months ago
0.5.1
9 months ago
0.5.0
10 months ago
0.4.2
10 months ago
0.4.1
10 months ago
0.4.0
10 months ago
0.3.1
10 months ago
0.3.0
10 months ago
0.2.0
10 months ago
0.1.1
10 months ago
0.1.0
11 months ago