Back to Browse

Django, HTMX and Alpine.js - Building an Accordion component

5.1K views
Feb 15, 2022
20:18

In this video, we'll build a simple accordion component, using Django, HTMX and Alpine.js We'll see how to load content with HTMX, and control which cards are shown in our accordion using Alpine.js. Code is based off a previous tutorial - get the "django-forms-dynamic" branch from this repository: https://github.com/bugbytes-io/django-htmx-chained-dropdown ๐Ÿ“Œ ๐—–๐—ต๐—ฎ๐—ฝ๐˜๐—ฒ๐—ฟ๐˜€: 00:00 Intro 00:31 Setup 01:02 Adding Alpine to project 03:28 Adding HTMX attributes to button 06:02 Building the accordion 07:28 Adding related modules to cards 08:53 Using prefetch_related method to avoid N+1 problem 10:04 Creating Alpine component 13:10 Showing multiple cards 18:22 Conditionally rendering icons โ˜•๏ธ ๐—•๐˜‚๐˜† ๐—บ๐—ฒ ๐—ฎ ๐—ฐ๐—ผ๐—ณ๐—ณ๐—ฒ๐—ฒ: To support the channel and encourage new videos, please consider buying me a coffee here: https://ko-fi.com/bugbytes โ–ถ๏ธ Full Playlist: https://www.youtube.com/playlist?list=PL-2EBeDYMIbQTx0h0EQfw3BXjqRQTiX_c ๐—ฆ๐—ผ๐—ฐ๐—ถ๐—ฎ๐—น ๐— ๐—ฒ๐—ฑ๐—ถ๐—ฎ: ๐Ÿ“– Blog: https://www.bugbytes.io/posts/ ๐Ÿ‘พ Github: https://github.com/bugbytes-io/django-htmx-chained-dropdown ๐Ÿฆ Twitter: https://twitter.com/bugbytesio ๐Ÿ“š ๐—™๐˜‚๐—ฟ๐˜๐—ต๐—ฒ๐—ฟ ๐—ฟ๐—ฒ๐—ฎ๐—ฑ๐—ถ๐—ป๐—ด ๐—ฎ๐—ป๐—ฑ ๐—ถ๐—ป๐—ณ๐—ผ๐—ฟ๐—บ๐—ฎ๐˜๐—ถ๐—ผ๐—ป: Install Alpine: https://alpinejs.dev/essentials/installation HTML Unicode Icons: https://www.htmlsymbols.xyz/unicode #django #alpinejs #python

Download

0 formats

No download links available.

Django, HTMX and Alpine.js - Building an Accordion component | NatokHD