classnames

Utility to create CSS class strings from a multitude of values without poking around with string templates and lengthy logic.


Keywords
classnames, css, css-classes, html, python
License
MIT
Install
pip install classnames==0.1.0

Documentation

Python classnames

pypi python Build Status codecov

Utility to create CSS class strings from a multitude of values without poking around with string templates and lengthy logic.

This project is a Python porting of the JS library classnames

Show me the code!

pip install classnames
from classnames import class_names

# render_button() -> "btn btn--red"
# render_button(rounded=True) -> "btn btn--rounded btn--red"
def render_button(rounded: bool = False, color = "red"):
    class_names("btn", f"btn--{color}", {
        "btn--rounded": rounded
    })

Features

  • TODO

Credits

This package was created with Cookiecutter and the waynerv/cookiecutter-pypackage project template.