Python classnames
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
})
- Documentation: https://lucafaggianelli.github.io/python-classnames
- GitHub: https://github.com/lucafaggianelli/python-classnames
- PyPI: https://pypi.org/project/python-classnames/
Features
- TODO
Credits
This package was created with Cookiecutter and the waynerv/cookiecutter-pypackage project template.