Getting started
@windmorph/react is a React component library implementing Material Design 3 Expressive, built on React Aria, Tailwind CSS v4 and Motion. This guide installs the package, wires up the stylesheet and fonts, and shows how icons and links work.
Install
Install the package together with motion, which is a peer dependency used by the animated components.
Browser support
0.1.0 is tested on Chrome and Edge. Safari 17.5+ and Firefox 129+ are supported targets, with full testing coming next. Older browsers skip some entry animations (@starting-style).
Add the stylesheet
In a Tailwind v4 project (Vite or Next.js), import Tailwind and the library tokens into your CSS entry. The @source line tells Tailwind to scan the compiled library so it generates the utility classes the components use. The library’s own stylesheet does the same with @source '../'.
@import 'tailwindcss';
@import '@windmorph/react/styles.css';
@source '../node_modules/@windmorph/react';Not using Tailwind? Import the precompiled stylesheet instead and skip the Tailwind setup.
/* No Tailwind? Import the precompiled stylesheet instead. */
import '@windmorph/react/styles.compiled.css';Wrap your app
Wrap the tree in ThemeProvider. It provides the colour theme, mode, contrast level and motion scheme, and remembers the selection between visits.
LocaleProvider takes the language your pages are written in, so date and time fields write dates, times and numbers that way. Without it they follow the browser's language, which may not be the page's. The words the components say are set separately, with a LabelsProvider.
import { LocaleProvider, ThemeProvider } from '@windmorph/react';
export function App({ children }) {
return (
<ThemeProvider defaultTheme="baseline">
<LocaleProvider locale="en-US">{children}</LocaleProvider>
</ThemeProvider>
);
}Load the font
Fonts are not bundled. Load Roboto Flex with next/font (or Google Fonts) and map it to the brand typeface variable. Without it, the type falls back to Roboto if the device has it, then the system UI font. The --md-ref-typeface-plain variable points at the brand variable so body text picks it up too.
// app/layout.tsx
import type { CSSProperties } from 'react';
import { Roboto_Flex } from 'next/font/google';
const robotoFlex = Roboto_Flex({
subsets: ['latin'],
axes: ['wdth', 'opsz', 'GRAD'],
variable: '--md-ref-typeface-brand',
display: 'swap',
});
export default function RootLayout({ children }) {
return (
<html lang="en" className={robotoFlex.variable}>
<body style={{ '--md-ref-typeface-plain': 'var(--md-ref-typeface-brand)' } as CSSProperties}>
{children}
</body>
</html>
);
}The type scale is in rem, defined at the browser's default 16px root, so text follows each reader's font-size setting while layout stays in px. Leave the root font size alone: don't set font-size on html (a 62.5% root shrinks every type role, and a px root ignores the reader's setting).
Icons
Icons are plain Material Symbols SVGs passed as React elements to props like icon or leadingIcon. Using fill="currentColor" lets each icon inherit the colour role of the component it sits in. There is no icon font.
import { Button } from '@windmorph/react';
// Material Symbols SVGs are passed as React elements; fill="currentColor" makes them
// inherit the component's colour role. No icon font is bundled.
const SearchIcon = (
<svg viewBox="0 -960 960 960" fill="currentColor" aria-hidden="true">
<path d="M784-120 532-372q-30 24-69 38t-83 14q-109 0-184.5-75.5T120-580q0-109 75.5-184.5T380-840q109 0 184.5 75.5T640-580q0 44-14 83t-38 69l252 252-56 56ZM380-400q75 0 127.5-52.5T560-580q0-75-52.5-127.5T380-760q-75 0-127.5 52.5T200-580q0 75 52.5 127.5T380-400Z" />
</svg>
);
<Button leadingIcon={SearchIcon}>Search</Button>;Links & routing
Links are an href on buttons, menu items and tabs, routed client-side through React Aria’s RouterProvider. For non-Next apps, wrap the tree in RouterProvider from react-aria with your router’s navigate helper, and its useHref when the app has a base path: every link then shows the router’s address, so opening it in a new tab or copying it reaches the right page. As in React Aria’s own links, every href goes through it, a #fragment included, so it should leave fragments and full URLs as they are (a router’s own useHref does).
// Non-Next apps: client-side links go through React Aria's RouterProvider.
import { RouterProvider } from 'react-aria';
import { useNavigate, useHref } from 'react-router';
function Providers({ children }) {
const navigate = useNavigate();
return (
<RouterProvider navigate={navigate} useHref={useHref}>
{children}
</RouterProvider>
);
}
// Then links are just an href on a component:
// <Button href="/pricing">Pricing</Button>On Next.js, use NextRouterProvider from @windmorph/react/next — a one-liner that wires RouterProvider to the Next router; give it your basePath and trailingSlash when next.config sets them, so links show the address Next’s own Link does. See the Next.js guide.
// Next.js: one-line integration.
import { NextRouterProvider } from '@windmorph/react/next';
<NextRouterProvider>{children}</NextRouterProvider>;Vite 8 note
Interactive modules ship with a "use client" directive. Vite 8 (rolldown) logs a harmless MODULE_LEVEL_DIRECTIVE warning for each one in client-only builds. Silence it in your Vite config.
// vite.config.ts — silence Vite 8's harmless "use client" warnings.
export default defineConfig({
build: {
rolldownOptions: {
onLog(level, log, handler) {
if (log.code !== 'MODULE_LEVEL_DIRECTIVE') handler(level, log);
},
},
},
});