accordion: make smooth animation toggleable

This commit is contained in:
2026-02-15 13:39:31 -07:00
parent c0966ceeb4
commit b8f703cda4
2 changed files with 13 additions and 0 deletions
+10
View File
@@ -5,7 +5,9 @@
{{/* Props: */}}
{{/*
Open: bool
Name: <details/> name attribute
GroupName: for doing 'open' css state styles
Smooth: bool, for 'smooth' opening animation, true by default
Class, Style,
SummaryClass, SummaryStyle
@@ -18,9 +20,11 @@
{{- if .GroupName }}
{{- $groupSuffix = printf "/%s" .GroupName }}
{{- end }}
{{- $smooth := ne .Smooth false }}
<details
{{if .Name}}name="{{.Name}}"{{end}}
class="
group{{$groupSuffix}}
@@ -38,13 +42,19 @@
open:details-content:p-[1em]
{{if $smooth}}
details-content:opacity-[0]
{{end}}
open:details-content:opacity-[1]
{{if $smooth}}
details-content:transform-[translate(0px,-2em)]
{{end}}
open:details-content:transform-[translate(0px,0px)]
{{if $smooth}}
details-content:transition-[opacity_transform]
{{end}}
{{.Class}}
"