Skip to content

Commit 5c6879e

Browse files
committed
docs: improve documentation for AI discoverability and SEO
Add comparison page, use cases guide, and optimize existing docs with explicit definitions, FAQ-style headings, and structured tables for better AI search engine visibility.
1 parent 1683e14 commit 5c6879e

10 files changed

Lines changed: 1848 additions & 1369 deletions

File tree

README.md

Lines changed: 49 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,60 @@
11
# css-variants
22

3-
Monorepo for **css-variants** — a zero-dependency, type-safe CSS variant composition library for modern JavaScript.
3+
**The fastest, smallest CSS variant library for JavaScript and TypeScript.**
4+
5+
A zero-dependency, type-safe alternative to CVA (Class Variance Authority) and tailwind-variants. Build powerful component style systems with variants — works with Tailwind CSS, vanilla CSS, CSS Modules, or any styling solution.
46

57
## Packages
68

7-
| Package | Description |
8-
|---------|-------------|
9-
| [css-variants](./packages/css-variants) | Core library for CSS variant composition |
9+
| Package | Description | Size |
10+
|---------|-------------|------|
11+
| [css-variants](./packages/css-variants) | Core library for CSS variant composition | ~1KB |
12+
13+
## Quick Start
14+
15+
```bash
16+
npm install css-variants
17+
```
18+
19+
```typescript
20+
import { cv } from 'css-variants'
21+
22+
const button = cv({
23+
base: 'px-4 py-2 rounded font-medium',
24+
variants: {
25+
color: {
26+
primary: 'bg-blue-600 text-white',
27+
secondary: 'bg-gray-200 text-gray-800',
28+
},
29+
size: {
30+
sm: 'text-sm px-3 py-1.5',
31+
lg: 'text-lg px-6 py-3',
32+
},
33+
},
34+
})
35+
36+
button({ color: 'primary', size: 'lg' })
37+
```
38+
39+
## Why css-variants?
40+
41+
| Feature | css-variants | CVA | tailwind-variants |
42+
|---------|:------------:|:---:|:-----------------:|
43+
| Bundle size | **~1KB** | ~2KB | ~5KB |
44+
| Performance | **Baseline** | 3-7x slower | 5-11x slower |
45+
| Slot variants | Built-in | No | Yes |
46+
| Style variants | Built-in | No | No |
47+
| Dependencies | 0 | 1 | 1 |
1048

1149
## Documentation
1250

13-
Full documentation available at **[css-variants.vercel.app](https://css-variants.vercel.app/)**
51+
Full documentation: **[css-variants.vercel.app](https://css-variants.vercel.app/)**
52+
53+
- [Getting Started](https://css-variants.vercel.app/getting-started/introduction/)
54+
- [API Reference](https://css-variants.vercel.app/api/cv/)
55+
- [Library Comparison](https://css-variants.vercel.app/resources/comparison/)
56+
- [Migration from CVA](https://css-variants.vercel.app/resources/migration-cva/)
57+
- [FAQ](https://css-variants.vercel.app/resources/faq/)
1458

1559
## License
1660

apps/docs/astro.config.mjs

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,34 @@ export default defineConfig({
9191
{
9292
label: 'Resources',
9393
items: [
94-
{ label: 'Migration from CVA', slug: 'resources/migration-cva' },
95-
{ label: 'Migration from Tailwind Variants', slug: 'resources/migration-tailwind-variants' },
96-
{ label: 'Performance', slug: 'resources/performance' },
97-
{ label: 'Benchmarks', slug: 'resources/benchmarks' },
98-
{ label: 'FAQ', slug: 'resources/faq' },
94+
{
95+
label: 'When Should You Use css-variants?',
96+
slug: 'resources/when-to-use',
97+
},
98+
{
99+
label: 'css-variants vs Other Libraries',
100+
slug: 'resources/comparison',
101+
},
102+
{
103+
label: 'Migrating from Class Variance Authority (CVA)',
104+
slug: 'resources/migration-cva',
105+
},
106+
{
107+
label: 'Migrating from tailwind-variants',
108+
slug: 'resources/migration-tailwind-variants',
109+
},
110+
{
111+
label: 'Performance Characteristics',
112+
slug: 'resources/performance',
113+
},
114+
{
115+
label: 'Benchmarks',
116+
slug: 'resources/benchmarks',
117+
},
118+
{
119+
label: 'Frequently Asked Questions (FAQ)',
120+
slug: 'resources/faq',
121+
},
99122
],
100123
},
101124
],

0 commit comments

Comments
 (0)