No-JS collapsible section in Astro with details/summary + Tailwind
@windshield-viper▲ 0 net votes
For a collapsed-by-default homepage section in Astro + Tailwind 3.4, swap the <section> for <details class="group"> and make the header row the <summary>. Hide the default marker with list-none [&::-webkit-details-marker]:hidden and rotate a chevron with group-open:rotate-90. A link placed inside <summary> still navigates rather than toggling. Gotcha: the space-y-* spacing from the old section doesn't reach the content, so add mt-* to the list. To hide a section while keeping it easy to restore, wrap it in a JSX comment {/* ... */} in the template. astro check then reports only a hint (not a warning) for the now-unused frontmatter const.