npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

astro-better-details

v0.1.3

Published

Expandable details/disclosure component for Astro

Readme

astro-better-details

Expandable <details> / <summary> disclosure component for Astro MDX. No JavaScript required -- the browser handles expand/collapse natively. The chevron animates with CSS.

Installation

npm install astro-better-details

Basic usage

Pass a plain string via the title prop:

import Details from 'astro-better-details/Details.astro';

<Details title="What is this?">
  This is the expanded content. It can contain any Markdown or MDX.
</Details>

Use the title slot when the header needs inline markup -- code, links, or components:

<Details>
  <span slot="title">Why use <code>astro-better-details</code>?</span>
  This is the expanded content. It can contain any Markdown or MDX.
</Details>

The title slot takes precedence over the title prop if both are provided. The default slot holds the body content shown when expanded.

Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | title | string | -- | Plain-text header label; use the title slot for inline markup | | open | boolean | false | Render the component already expanded | | class | string | -- | Additional CSS class(es) applied to the <details> element |

Slots

| Slot | Description | |------|-------------| | title (named) | Header content with inline markup; takes precedence over the title prop | | default | Body content, shown when expanded |

Theming

The component uses CSS custom properties for all visual values. Override them on .abt-details or any parent selector to match your brand:

| Property | Default | Controls | |----------|---------|----------| | --abt-details-border | #d1d5db | Border color around the whole component and between summary/body | | --abt-details-summary-bg | #f9fafb | Background of the summary bar | | --abt-details-chevron | #9ca3af | Chevron icon color |

Example -- purple light mode, orange dark mode to match a common docs site palette:

.abt-details {
  --abt-details-border:     #ddd6fe;
  --abt-details-summary-bg: #f5f3ff;
  --abt-details-chevron:    #7c3aed;
}

.dark .abt-details {
  --abt-details-border:     #1c0e00;
  --abt-details-summary-bg: #0f0f0f;
  --abt-details-chevron:    #fb923c;
}

If your project uses a data-theme attribute instead of a .dark class, adjust the selector accordingly.

Code blocks inside Details

The body slot renders its content as raw HTML. Code block titles (the title="..." meta from astro-better-code-blocks) render correctly because that package's CSS targets .code-figure globally. Do not add a .prose class to the body if you use Tailwind Typography -- the typography plugin styles <figcaption> as italic, which would override the font-style: normal on code titles.

If your site needs prose-style typography inside the body, apply it via a wrapper element inside the slot rather than on the component itself:

<Details>
  <span slot="title">Example</span>
  <div class="prose">
    Content here gets prose styling.
  </div>
</Details>

Accessibility

The component renders a native <details> / <summary> element pair. Screen readers expose this as a disclosure widget with the summary as the interactive label. No ARIA attributes need to be added manually.