Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@collapsed/lit

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@collapsed/lit

![NPM Version](https://img.shields.io/npm/v/%40collapsed%2Flit) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/%40collapsed%2Flit)

  • 0.0.1
  • latest
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

@collapsed/lit

NPM Version npm bundle size

A Lit element for creating accessible expand/collapse elements. Animates the height using CSS transitions from 0 to auto.

Features

  • Handles the height of animations of your elements, auto included!
  • Minimally-styled to be functional--you control the styles.
  • No animation framework required! Simply powered by CSS animations.

Installation

npm install @collapsed/lit

Usage

import { CollapsedDisclosure } from "@collapsed/lit";
import { html } from "lit";

export function App() {
  function handleClick(evt) {
    const collapse = document.querySelector("#disclosure");
    const btn = event.target;
    collapse.toggleAttribute("open");
    btn.setAttribute("aria-expanded", collapse.hasAttribute("open").toString());
  }

  return html`<div>
    <button
      aria-controls="disclosure"
      aria-expanded="false"
      @click="${handleClick}"
    >
      Toggle
    </button>
    <collapsed-disclosure id="disclosure">
      <!-- Content goes here -->
    </collapsed-disclosure>
  </div>`;
}

FAQs

Package last updated on 21 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc