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

@tevui/tevui-utils

v1.0.0

Published

A React component that expands and collapses content when its title is clicked, with height and opacity animations.

Readme

Accordion

A React component that expands and collapses content when its title is clicked, with height and opacity animations.

Installation

npm install @tevui/accordion

Usage

"use client";

import { Accordion } from "@tevui/accordion";

export default function Example() {
  return (
    <Accordion
      title="Details"
      id="details-accordion"
      showContent={false}
      onClick={(isOpen: boolean) => console.log("Open:", isOpen)}
    >
      <p>Accordion content.</p>
    </Accordion>
  );
}

Props

| Prop | Type | Default | Description | | --------------- | ------------------------------------------- | ------------------- | --------------------------------------------------------------------------------------------------------------- | | title | string | — | Required. Text of the button that expands and collapses the content. | | showContent | boolean | false | Required by the current type definition. Sets the initial expanded state. | | onClick | () => void or (isOpen: boolean) => void | — | Callback invoked on click, receiving the new expanded state. | | disabled | boolean | false | Disables the button and prevents toggling by clicking. | | children | React.ReactNode or React.ReactNode[] | — | Content displayed when expanded. | | id | string | "tevui-accordion" | Button identifier and prefix for content identifiers. Use a unique value for each instance. | | hasError | boolean | false | Applies the error color to the borders. | | showErrorIcon | boolean | false | Displays an icon beside the title: an error icon when hasError is true, or a check icon when it is false. |

Expanding and collapsing

The component manages the isShowContent state internally. Each button click toggles this state and calls onClick with the new value.

showContent is only used to initialize the state. Changing this prop after mounting does not update the component's expanded state.

Transitions from false to true and from true to false animate height and opacity over 250 ms, using the ease timing function. The height adapts to the content without a fixed limit.

The content remains mounted while collapsing and while collapsed, preserving the state of child components. When collapsed, it is hidden and receives inert, preventing focus and interaction. Animations are disabled when the user prefers reduced motion (prefers-reduced-motion: reduce).