File tree 1 file changed +13
-5
lines changed
1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -6,21 +6,29 @@ This gem is essentially a clone if the [clsx](https://github.com/lukeed/clsx) np
6
6
It provides a simple way to conditionally apply classes to HTML elements in Rails views.
7
7
It is especially useful when you have a lot of conditional classes and you want to keep your views clean and readable.
8
8
9
+ ## Supported Ruby and Rails versions
10
+
11
+ Ruby 3.1+ and Rails 7.0+ are supported.
12
+
9
13
## Installation
10
14
11
15
Install the gem and add to the application's Gemfile by executing:
12
16
13
- $ bundle add clsx-rails
17
+ ``` bash
18
+ bundle add clsx-rails
19
+ ```
14
20
15
- If bundler is not being used to manage dependencies, install the gem by executing :
21
+ Or add it manually to the Gemfile :
16
22
17
- $ gem install clsx-rails
23
+ ``` ruby
24
+ gem ' clsx-rails' , ' ~> 1.0'
25
+ ```
18
26
19
27
## Usage
20
28
21
- The ` clsx ` method can be used in views to conditionally apply classes to HTML elements.
29
+ The ` clsx ` helper method can be used in views to conditionally apply classes to HTML elements.
22
30
You can also use a slightly more conise ` cn ` alias.
23
- It accepts a variety of arguments and returns a string of classes.
31
+ It accepts a variety of arguments and returns a string of unique classes.
24
32
25
33
``` ruby
26
34
# Strings (variadic)
You can’t perform that action at this time.
0 commit comments