lion/docs/components/collapsible/overview.md
Pavlik Kiselev 11bbc5fff5
feat: migrated the navigation metadata from inline MD title decorations to frontmatter
* feat: migrated the navigation metadata from inline MD title decorations to frontmatter

* fix: fixed frontmatter metadate for api-table MDs

* fix: fixed frontmatter eslint issue
2025-03-19 10:08:22 +01:00

1.5 KiB

parts title eleventyNavigation
Collapsible
Overview
Collapsible: Overview
key order parent title
Collapsible: Overview 10 Collapsible Overview

Collapsible: Overview

A combination of a button (the invoker) and a chunk of 'extra content'. This web component can be extended with an animation to disclose the extra content. There are two slots available respectively; invoker to specify the collapsible's invoker and content for the extra content of the collapsible.

import { html } from '@mdjs/mdjs-preview';
import '@lion/ui/define/lion-collapsible.js';
export const main = () => html`
  <lion-collapsible>
    <button slot="invoker">More about cars</button>
    <div slot="content">
      Most definitions of cars say that they run primarily on roads, seat one to eight people, have
      four tires, and mainly transport people rather than goods.
    </div>
  </lion-collapsible>
`;

Features

  • Use opened attribute or toggle() method to render default open.
  • invoker slot can be custom template e.g. our button or native button with custom styling.
  • Observe the state with the help of @opened-changed event.
  • show() and hide() are helper methods to hide or show the content from outside.

Installation

npm i --save @lion/ui
import { LionCollapsible } from '@lion/ui/collapsible.js';
// or
import '@lion/ui/define/lion-collapsible.js';