Comments (5)
Very supportive of this proposal as it would also support htmx in addition to Alpine.js. For example, with a button component
{% component "button"
attrs:hx-post="{% url 'document-upload' document_uid=document.uid %}"
attrs:hx-target="#document-output" %}
Upload Document
{% endcomponent %}
and the button's template.html:
<button type="submit" class="text-white bg-primary-700" {{ attrs }}>
{% slot "content" default %}
{% endslot %}
</button>
And the rendered HTML:
<button type="submit" class="text-white bg-primary-700" hx-post="/documents/upload/1" hx-target="#document-output">
Upload Document
</button>
from django-components.
Hi all, this feature has just been released as v0.74 π See the README section "Rendering HTML attributes"
from django-components.
I take none of the credit here, all the hard work is done by @JuroOravec π₯³
from django-components.
Wow! Great work @JuroOravec && @EmilStenstrom !! You guys worked at an amazing speed to get this out, thank you both!
from django-components.
@zachbellay I donβt think nesting tags like that would work, but you can get the url βas urlβ on a separate line and then use it like you do there. Iβm excited about it too!
from django-components.
Related Issues (20)
- Tests refactor: Move from template files to inline templates HOT 2
- Define public API HOT 1
- template_loader blocks on STATICFILES_DIRS if there are tuples HOT 1
- Allow to render component dependencies without middleware HOT 24
- Feature parity with Juro's fork HOT 1
- Topic on new behaviour for dispatching slots using 'include' tags HOT 2
- Scoped slots - Passing data to slots and accessing them in fills HOT 20
- Revert back to "django" as the default setting for "context_behavior"
- Refactor accessing of default slot from `as var` to kwarg HOT 3
- '
- Bug: Cannot override `block` tag inside `component` tag inside a template imported via `extends` in "django" mode HOT 2
- Support for dynamically loading component's JS/CSS dependencies HOT 2
- Typo Preventing html_attrs defaults from working HOT 2
- Inline tests/templates to make tests easier to follow HOT 1
- Allow to render a component, passing args and kwargs, from Python HOT 3
- Support for Paths as objects is missing HOT 25
- Allow users to customize component tags + reintroduce component "inline" block HOT 3
- This hyperlink is dead - There is no "Registering Components" in latest readme (0.82) HOT 2
- safer_staticfiles working? HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-components.