Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cxclsx #152

Merged
merged 1 commit into from
Apr 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/pages/docs/api-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const component = cva("base", options);

### Parameters

1. `base`: the base class name (`string`, `string[]` or `null`)
1. `base`: the base class name (`string`, `string[]` or other [`clsx` value](https://github.com/lukeed/clsx#input))
1. `options` _(optional)_
- `variants`: your variants schema
- `compoundVariants`: variants based on a combination of previously defined variants
Expand All @@ -23,15 +23,15 @@ A `cva` component function

## `cx`

Concatenates class names
Concatenates class names (an alias of [`clsx`](https://github.com/lukeed/clsx))

```ts
const className = cx(classes);
```

### Parameters

- `classes`: array of classes to be concatenated
- `classes`: array of classes to be concatenated ([see `clsx` usage](https://github.com/lukeed/clsx#input))

### Returns

Expand Down
2 changes: 2 additions & 0 deletions docs/pages/docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ Creating variants with the "traditional" CSS approach can become an arduous task
- [**clb**](https://github.com/crswll/clb) ([Bill Criswell](https://github.com/crswll))
This project originally started out with the intention of merging into the wonderful [`clb`](https://github.com/crswll/clb) library, but after some discussion with Bill, we felt it was best to go down the route of a separate project.
I'm so grateful to Bill for sharing his work publicly and for getting me excited about building a type-safe variants API for classes. If you have a moment, please go and [star the project on GitHub](https://github.com/crswll/clb). Thank you Bill!
- [**clsx**](https://github.com/lukeed/clsx) ([Luke Edwards](https://github.com/lukeed))
Previously, this project surfaced a custom `cx` utility for flattening classes, but it lacked the ability to handle variadic arguments or objects. [clsx](https://github.com/lukeed/clsx) provided those extra features with quite literally zero increase to the bundle size – a no-brainer to switch!
- [**Vanilla Extract**](http://vanilla-extract.style) ([Seek](https://github.com/seek-oss))

## Downloads
Expand Down
3 changes: 3 additions & 0 deletions packages/class-variance-authority/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
"test:jest": "jest --config .config/jest.config.ts --coverage",
"test:size": "pnpm build && bundlesize -f 'dist/*.js' -s 850B"
},
"dependencies": {
"clsx": "1.2.1"
},
"devDependencies": {
"@jest/types": "28.1.1",
"@swc/cli": "0.1.57",
Expand Down
Loading