0.1.3 • Published 1 year ago

@inlite/solidjs-typed-classlist v0.1.3

Weekly downloads
-
License
-
Repository
github
Last release
1 year ago

SolidJS Typed Classes

This library provides classnames and classlist functions designed to work in a SolidJS environment with an postcss-ts-classnames plugin. You can get IDE-validation and auto-completion of your CSS classes in ts code.

Installation

To install the library, use the following command:

npm install solidjs-typed-classlist

Usage

First, generate classnames definitions using the postcss-ts-classnames plugin. Then, re-export the classlist and classnames functions from this package as follows:

import { classlist, classnames } from 'solidjs-typed-classlist';

const cl = classlist<ClassList>;
const cn = classnames<ClassList>;

Example

Here is an example of how to use the cl and cn functions in your SolidJS components:

import { cl, cn } from './path-to-your-re-exported-functions';

const MyComponent = () => {
  return (
    <div classList={cl("my-class1", { "my-class2": true, "my-class3":expression })}>
      <span class={cn('myClass', 'anotherClass')}>Hello, SolidJS!</span>
    </div>
  );
};
0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago