Skip to content

Commit a6b9edc

Browse files
feat: add coss/style preset for full project setup (#710)
* feat: add coss/style preset for full project setup * improve the docs
1 parent fcb2b89 commit a6b9edc

File tree

8 files changed

+556
-102
lines changed

8 files changed

+556
-102
lines changed

apps/ui/content/docs/(root)/get-started.mdx

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,37 @@ You can add components **automatically with the shadcn CLI** or **manually by co
1717

1818
Each component page provides a command to add it to your project automatically. The CLI will create the necessary files and install any dependencies for you.
1919

20-
### Install all UI Components
20+
### New Project Setup (Recommended)
2121

22-
You can install all **coss ui** primitives at once with a single command:
22+
For new projects, use the **coss style** preset to initialize everything in one command:
23+
24+
```bash
25+
npx shadcn@latest init coss/style
26+
```
27+
28+
This installs all UI components, the neutral color system, sidebar variables, font variables, and base styles. Components like Dialog and AlertDialog use `font-heading` for titles—the style preset provides sensible fallbacks, and you can customize fonts via `next/font` in your layout.
29+
30+
### Existing Projects
31+
32+
To add components to an existing project:
2333

2434
```bash
2535
npx shadcn@latest add @coss/ui
2636
```
2737

28-
This will add all UI components to your project in one go, including button, card, avatar, dialog, tabs, and more.
38+
This adds all UI primitives (button, card, avatar, dialog, tabs, and more). For the full theme including colors, sidebar, and fonts:
39+
40+
```bash
41+
npx shadcn@latest add @coss/style
42+
```
2943

30-
**Recommended**: Install with our optimized color tokens for the best visual results:
44+
Or add only the color tokens:
3145

3246
```bash
3347
npx shadcn@latest add @coss/ui @coss/colors-neutral
3448
```
3549

36-
This command installs both the UI components and our default neutral-based color system, which provides crisp, contrasted borders and enhanced visual depth. See the [Styling](/ui/docs/styling) guide for more details about our color system.
50+
See the [Styling](/ui/docs/styling) guide for more details.
3751

3852
### Manually
3953

apps/ui/content/docs/(root)/styling.mdx

Lines changed: 24 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -13,33 +13,13 @@ While this color system is optional, it's designed to provide optimal visual res
1313

1414
## Installation
1515

16-
<CodeTabs>
17-
18-
<TabsList>
19-
<TabsTab value="cli">CLI</TabsTab>
20-
<TabsTab value="manual">Manual</TabsTab>
21-
</TabsList>
22-
23-
<TabsPanel value="cli">
24-
25-
```bash
26-
npx shadcn@latest add @coss/colors-neutral
27-
```
28-
29-
This command will override your existing color variables. We're currently providing a default configuration based on neutral colors, but we plan to add more color variants in the future to give you more styling options while maintaining the same optimization principles.
30-
31-
</TabsPanel>
32-
33-
<TabsPanel value="manual">
34-
35-
<Steps>
36-
37-
<Step>
38-
Copy and paste the following CSS variables into your `globals.css` file:
39-
</Step>
16+
See [Get Started](/ui/docs/get-started) for installing with the CLI. If you prefer to add the theme manually, paste the following into your `globals.css`:
4017

4118
```css title="app/globals.css"
4219
@theme inline {
20+
--font-sans: var(--font-sans);
21+
--font-heading: var(--font-heading);
22+
--font-mono: var(--font-mono);
4323
--color-background: var(--background);
4424
--color-foreground: var(--foreground);
4525
--color-sidebar-ring: var(--sidebar-ring);
@@ -183,25 +163,29 @@ This command will override your existing color variables. We're currently provid
183163
}
184164
```
185165

186-
</Steps>
187-
188-
</TabsPanel>
189-
190-
</CodeTabs>
191-
192-
## Extended Color Variables
166+
## Font Variables
193167

194-
We've introduced additional color variables beyond the standard shadcn/ui palette to provide more control for specific components like badges and alerts:
168+
Components like Dialog, AlertDialog, Sheet, and Empty use the `font-heading` class for titles. The coss style preset defines `--font-sans`, `--font-heading`, and `--font-mono` with system font fallbacks. To use custom fonts, define these variables in your layout using `next/font`:
195169

196-
- `--destructive-foreground`: Foreground color for destructive actions
197-
- `--info`: Information state color
198-
- `--info-foreground`: Foreground color for information states
199-
- `--success`: Success state color
200-
- `--success-foreground`: Foreground color for success states
201-
- `--warning`: Warning state color
202-
- `--warning-foreground`: Foreground color for warning states
170+
```tsx title="app/layout.tsx"
171+
import { Geist, Geist_Mono } from "next/font/google";
172+
173+
const fontSans = Geist({ variable: "--font-sans", subsets: ["latin"] });
174+
const fontHeading = Geist({ variable: "--font-heading", subsets: ["latin"], weight: "600" });
175+
const fontMono = Geist_Mono({ variable: "--font-mono", subsets: ["latin"] });
176+
177+
export default function RootLayout({ children }) {
178+
return (
179+
<html lang="en">
180+
<body className={`${fontSans.variable} ${fontHeading.variable} ${fontMono.variable} font-sans`}>
181+
{children}
182+
</body>
183+
</html>
184+
);
185+
}
186+
```
203187

204-
These additional variables ensure consistent styling across components that need to communicate different states or levels of importance.
188+
Apply the variables to `html` or `body` so they cascade. The `font-sans` class sets the default body font.
205189

206190
## Base UI Setup
207191

apps/ui/public/r/combobox.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
"type": "registry:ui"
1717
}
1818
]
19-
}
19+
}

apps/ui/public/r/registry.json

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10276,6 +10276,131 @@
1027610276
],
1027710277
"type": "registry:block"
1027810278
},
10279+
{
10280+
"css": {
10281+
"@layer base": {
10282+
"*": {
10283+
"@apply border-border outline-ring/50": {}
10284+
},
10285+
"body": {
10286+
"@apply bg-background text-foreground": {}
10287+
},
10288+
"code, kbd, samp, pre": {
10289+
"font-family": "var(--font-mono)"
10290+
}
10291+
}
10292+
},
10293+
"cssVars": {
10294+
"dark": {
10295+
"accent": "--alpha(var(--color-white) / 4%)",
10296+
"accent-foreground": "var(--color-neutral-100)",
10297+
"background": "color-mix(in srgb, var(--color-neutral-950) 95%, var(--color-white))",
10298+
"border": "--alpha(var(--color-white) / 6%)",
10299+
"card": "color-mix(in srgb, var(--background) 98%, var(--color-white))",
10300+
"card-foreground": "var(--color-neutral-100)",
10301+
"destructive": "color-mix(in srgb, var(--color-red-500) 90%, var(--color-white))",
10302+
"destructive-foreground": "var(--color-red-400)",
10303+
"foreground": "var(--color-neutral-100)",
10304+
"info": "var(--color-blue-500)",
10305+
"info-foreground": "var(--color-blue-400)",
10306+
"input": "--alpha(var(--color-white) / 8%)",
10307+
"muted": "--alpha(var(--color-white) / 4%)",
10308+
"muted-foreground": "color-mix(in srgb, var(--color-neutral-500) 90%, var(--color-white))",
10309+
"popover": "color-mix(in srgb, var(--background) 98%, var(--color-white))",
10310+
"popover-foreground": "var(--color-neutral-100)",
10311+
"primary": "var(--color-neutral-100)",
10312+
"primary-foreground": "var(--color-neutral-800)",
10313+
"ring": "var(--color-neutral-500)",
10314+
"secondary": "--alpha(var(--color-white) / 4%)",
10315+
"secondary-foreground": "var(--color-neutral-100)",
10316+
"success": "var(--color-emerald-500)",
10317+
"success-foreground": "var(--color-emerald-400)",
10318+
"warning": "var(--color-amber-500)",
10319+
"warning-foreground": "var(--color-amber-400)",
10320+
"chart-1": "var(--color-blue-700)",
10321+
"chart-2": "var(--color-emerald-500)",
10322+
"chart-3": "var(--color-amber-500)",
10323+
"chart-4": "var(--color-purple-500)",
10324+
"chart-5": "var(--color-rose-500)",
10325+
"code": "color-mix(in srgb, var(--background) 98%, var(--color-white))",
10326+
"code-foreground": "var(--foreground)",
10327+
"code-highlight": "--alpha(var(--color-white) / 4%)",
10328+
"sidebar": "color-mix(in srgb, var(--color-neutral-950) 97%, var(--color-white))",
10329+
"sidebar-accent": "--alpha(var(--color-white) / 4%)",
10330+
"sidebar-accent-foreground": "var(--color-neutral-100)",
10331+
"sidebar-border": "--alpha(var(--color-white) / 5%)",
10332+
"sidebar-foreground": "color-mix(in srgb, var(--color-neutral-100) 64%, var(--sidebar))",
10333+
"sidebar-primary": "var(--color-neutral-100)",
10334+
"sidebar-primary-foreground": "var(--color-neutral-800)",
10335+
"sidebar-ring": "var(--color-neutral-400)"
10336+
},
10337+
"light": {
10338+
"accent": "--alpha(var(--color-black) / 4%)",
10339+
"accent-foreground": "var(--color-neutral-800)",
10340+
"background": "var(--color-white)",
10341+
"border": "--alpha(var(--color-black) / 8%)",
10342+
"card": "var(--color-white)",
10343+
"card-foreground": "var(--color-neutral-800)",
10344+
"destructive": "var(--color-red-500)",
10345+
"destructive-foreground": "var(--color-red-700)",
10346+
"foreground": "var(--color-neutral-800)",
10347+
"info": "var(--color-blue-500)",
10348+
"info-foreground": "var(--color-blue-700)",
10349+
"input": "--alpha(var(--color-black) / 10%)",
10350+
"muted": "--alpha(var(--color-black) / 4%)",
10351+
"muted-foreground": "color-mix(in srgb, var(--color-neutral-500) 90%, var(--color-black))",
10352+
"popover": "var(--color-white)",
10353+
"popover-foreground": "var(--color-neutral-800)",
10354+
"primary": "var(--color-neutral-800)",
10355+
"primary-foreground": "var(--color-neutral-50)",
10356+
"ring": "var(--color-neutral-400)",
10357+
"secondary": "--alpha(var(--color-black) / 4%)",
10358+
"secondary-foreground": "var(--color-neutral-800)",
10359+
"success": "var(--color-emerald-500)",
10360+
"success-foreground": "var(--color-emerald-700)",
10361+
"warning": "var(--color-amber-500)",
10362+
"warning-foreground": "var(--color-amber-700)",
10363+
"chart-1": "var(--color-orange-600)",
10364+
"chart-2": "var(--color-teal-600)",
10365+
"chart-3": "var(--color-cyan-900)",
10366+
"chart-4": "var(--color-amber-400)",
10367+
"chart-5": "var(--color-amber-500)",
10368+
"code": "var(--color-white)",
10369+
"code-foreground": "var(--foreground)",
10370+
"code-highlight": "--alpha(var(--color-black) / 4%)",
10371+
"radius": "0.625rem",
10372+
"sidebar": "var(--color-neutral-50)",
10373+
"sidebar-accent": "--alpha(var(--color-black) / 4%)",
10374+
"sidebar-accent-foreground": "var(--color-neutral-800)",
10375+
"sidebar-border": "--alpha(var(--color-black) / 6%)",
10376+
"sidebar-foreground": "color-mix(in srgb, var(--color-neutral-800) 64%, var(--sidebar))",
10377+
"sidebar-primary": "var(--color-neutral-800)",
10378+
"sidebar-primary-foreground": "var(--color-neutral-50)",
10379+
"sidebar-ring": "var(--color-neutral-400)"
10380+
},
10381+
"theme": {
10382+
"font-heading": "var(--font-heading, ui-sans-serif, system-ui, sans-serif)",
10383+
"font-mono": "var(--font-mono, ui-monospace, monospace)",
10384+
"font-sans": "var(--font-sans, ui-sans-serif, system-ui, sans-serif)"
10385+
}
10386+
},
10387+
"dependencies": [
10388+
"@base-ui/react",
10389+
"class-variance-authority",
10390+
"lucide-react"
10391+
],
10392+
"description": "Complete coss theme: colors, sidebar, fonts, and base styles. Use with `npx shadcn init coss/style` for full project setup.",
10393+
"devDependencies": [
10394+
"tw-animate-css"
10395+
],
10396+
"extends": "none",
10397+
"name": "style",
10398+
"registryDependencies": [
10399+
"utils",
10400+
"@coss/ui"
10401+
],
10402+
"type": "registry:style"
10403+
},
1027910404
{
1028010405
"cssVars": {
1028110406
"dark": {

apps/ui/public/r/select.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
"type": "registry:ui"
1313
}
1414
]
15-
}
15+
}

0 commit comments

Comments
 (0)