clsx-r
A Rust macro utility for conditionally constructing strings, primarily used for CSS class names. Inspired by the JavaScript clsx package.
Installation
Add this to your Cargo.toml:
[]
= "0.1.0"
Usage
use clsx;
Features
- Simple string concatenation
- Conditional class names
- Supports static and dynamic strings
- Filters out empty strings automatically
- Zero dependencies
API
The clsx! macro accepts:
-
Simple string literals or expressions:
clsx! -
Conditional classes using the
=>syntax:clsx! -
Mixed usage:
clsx!
License
MIT License
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.