Installation
Add Wideset to a React project, as source you own or as a package.
There are two ways to add Wideset. Pick one per project.
| Scaffold with the CLI | Install the package | |
|---|---|---|
| Code | Copied into your repo, yours to edit | In node_modules, not editable |
| Updates | None; the code is yours from then on | Through semver |
| Best for | Prototypes, heavily branded projects | Long-lived products |
Both need React 18 or 19.
Scaffold with the CLI
The CLI copies a component’s source into your project, with everything it depends on. It works in Vite and Next.js projects with TypeScript, with or without Tailwind.
1. Run init
npx wideset init
Run it once. It writes components.json, adds the @/* path alias, imports the Wideset
stylesheet at your app’s entry point and sets Inter as the page font. Pass --no-font to keep
your own font.
Already using shadcn? init keeps your components.json and only registers the @wideset
namespace.
2. Add components
npx wideset add button select
Files land in components/ui/wideset/, with their helpers in lib/wideset/ and
hooks/wideset/. npx wideset list shows every component, and npx wideset add --all installs
them all.
3. Use them
import { Button } from '@/components/ui/wideset/button/Button';
export function Example() {
return <Button>Save</Button>;
}
Add a block
A block is a whole screen. It installs the same way, under blocks/wideset/:
npx wideset add block-calendar
The Blocks catalog has the command and the file list for each one.
With the shadcn CLI
Wideset is a shadcn registry, and wideset runs the
shadcn CLI underneath. In a project that already has a components.json you can call shadcn
yourself:
npx shadcn@latest registry add @wideset=https://wideset.co/r/{name}.json
npx shadcn@latest add @wideset/button @wideset/select
Then import @/styles/wideset.css once at your app’s entry point. wideset init does that step
for you.
An app without Tailwind also needs the browser reset. Add it and import it first:
npx shadcn@latest add @wideset/preflight
import '@/styles/wideset-preflight.css';
import '@/styles/wideset.css';
Install the package
The package gives you the same components from node_modules, with fixes and new components
arriving as updates.
1. Install
npm install @wideset/react @remixicon/react
Components take their icons from Remix Icon. Everything else Wideset needs is bundled.
2. Import the stylesheet
Once, at your app’s entry point (main.tsx, app/layout.tsx), before your own styles so your
overrides win:
import '@wideset/react/styles';
Two more stylesheets are there when you need them:
| Import | Add it when |
|---|---|
@wideset/react/preflight |
Your app does not use Tailwind. It is Tailwind’s browser reset. |
@wideset/react/theme |
Your app uses Tailwind v4 and you want Wideset classes in your own code. |
The theme goes in your Tailwind entry CSS, next to styles and never in place of it:
@import 'tailwindcss';
@import '@wideset/react/theme';
3. Load the font
Components inherit the font on body. Wideset is designed with Inter, and --font-ws-sans holds
the stack:
body {
font-family: var(--font-ws-sans);
}
In Vite, npm install @fontsource-variable/inter, then:
import '@fontsource-variable/inter';
:root {
--font-ws-sans: 'Inter Variable', ui-sans-serif, system-ui, sans-serif;
}
In Next.js, next/font sets the variable for you:
import { Inter } from 'next/font/google';
const inter = Inter({ subsets: ['latin'], variable: '--font-ws-sans' });
// <html className={inter.variable}> in the root layout
Use a variable font. Wideset’s weights are not round numbers (medium is 520), and a static font rounds them to its nearest cut.
4. Use a component
import { Button } from '@wideset/react';
export function Example() {
return <Button>Save</Button>;
}
Next.js
Wideset components are Client Components and each module starts with 'use client', so you can
import them straight into a Server Component. Two rules apply there:
- Use the named export of a part.
Card.Headerisundefinedin a Server Component, andCardHeaderworks. - Anything that passes a function needs a Client Component. An icon prop is a function, like
onClick, so put that piece in a file that starts with'use client'.
// app/page.tsx: a Server Component
import { Card, CardContent, CardHeader, CardTitle } from '@wideset/react';
export default function Page() {
return (
<Card>
<CardHeader>
<CardTitle>Invoices</CardTitle>
</CardHeader>
<CardContent>…</CardContent>
</Card>
);
}
create-next-app turns on cacheComponents, and a prerender then stops at anything that reads
the clock while it renders. Calendar shown directly on a page and DateRangePicker with
defaultDatePreset need today’s date: pass today, or wrap them in <Suspense>.
Existing global CSS
Wideset’s stylesheet is written in cascade layers, and a rule of yours outside any layer beats every layer. Two things in an app’s own CSS therefore show up in the components.
A reset on *. * { margin: 0; padding: 0 } removes the padding of every button, input and
card. Put it in the base layer, which is one of Wideset’s and sits below the components:
@layer base {
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
}
Colours switched by prefers-color-scheme. Wideset turns dark with a dark class and
ignores the system setting. A stylesheet that flips the page with
@media (prefers-color-scheme: dark), as the create-next-app template does, leaves light
components on a dark page. Remove that block, or set the class when the system is dark, as shown
in Dark mode.