HTMX Components for Flask
Project description
Dynamic server-generated HTML UI components
HTMX Components are server-generated HTML UI components, that use the HTMX library to make them dynamic
Features:
- Works with and without JavaScript enabled
- No need to write any JavaScript
Available Widgets/Components:
- GridView
- Dynamic Form
- TreeView
- more soon!
See them in action: http://htmxcomponents.pythonanywhere.com/
Language Support:
- Python
- more soon!
Framework Support:
- Flask
- Django, FastAPI coming soon!
Example application: https://github.com/neilmcguigan/htmx-components-flask-example
Installation:
pip install htmx-components-flask
Example Usage (Flask):
from flask import Flask, render_template_string, request
from htmx_components_flask import htmx_components_flask
from flask_wtf import FlaskForm
import wtforms
app = Flask(__name__)
app.register_blueprint(htmx_components_flask)
app.config["SECRET_KEY"] = "s3cr3t"
class MyForm(FlaskForm):
stringfield = wtforms.StringField("String", validators=[wtforms.validator.InputRequired()])
submitbtn = wtforms.SubmitField("Submit")
# assumes you have a file templates/base.html that includes the htmx script:
@app.get("/", methods=["GET", "POST"])
def index():
form = MyForm(request.form)
form.validate_on_submit()
return render_template_string("""
{% if "HX-Request" not in request.headers %}
{% extends "base.html" %}
{% endif %}
{% block content %}
{% include "htmx_components_flask/form/horizontal.html" %}
{% endblock %}
""", form=form)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file htmx-components-flask-0.0.2.tar.gz.
File metadata
- Download URL: htmx-components-flask-0.0.2.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7b4d4117ed1925d4d8306356c7adc4af30016d2b19882ade0f0c7da99115eae
|
|
| MD5 |
04704176229e421b4849bfadb150b305
|
|
| BLAKE2b-256 |
dce8852621454ba792feaed0ab4ef8075621e713a276c118c67ac7e1c2335d78
|
File details
Details for the file htmx_components_flask-0.0.2-py3-none-any.whl.
File metadata
- Download URL: htmx_components_flask-0.0.2-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
84c88da80214567236cd51433149e7335e34bbaec095b97489a45829b700333b
|
|
| MD5 |
006e38150e0b96c6e1d8da2bedfce378
|
|
| BLAKE2b-256 |
40f226a713e09893667e18c9c5299622c7f583cfcc0698a7805a8287a0230137
|