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

@yoopta/accordion

v6.0.1

Published

Accordion plugin for Yoopta Editor

Readme

@yoopta/accordion

Accordion plugin for Yoopta Editor with headless architecture. Use as-is (headless) or attach theme UI from @yoopta/themes-shadcn.

Installation

yarn add @yoopta/accordion

Usage

Pass the plugin to createYooptaEditor. Do not pass plugins to <YooptaEditor>.

import { useMemo } from 'react';
import YooptaEditor, { createYooptaEditor } from '@yoopta/editor';
import Accordion from '@yoopta/accordion';

const plugins = [Accordion];

export default function Editor() {
  const editor = useMemo(() => createYooptaEditor({ plugins, marks: [] }), []);
  return <YooptaEditor editor={editor} onChange={() => {}} />;
}

Themed UI (Shadcn)

Apply theme to all plugins or only Accordion:

import { applyTheme } from '@yoopta/themes-shadcn';
const plugins = applyTheme([Paragraph, Accordion, /* ... */]);

Or extend a single plugin:

import Accordion from '@yoopta/accordion';
import { AccordionUI } from '@yoopta/themes-shadcn/accordion';

const AccordionWithUI = Accordion.extend({ elements: AccordionUI });
const plugins = [AccordionWithUI];

Headless architecture

  • Headless core (@yoopta/accordion) — logic, commands, events (no UI)
  • Theme packages (e.g. @yoopta/themes-shadcn) — pre-built styled elements

You can also build custom UI by extending with your own elements (see Custom UI below).

Custom UI

Create your own UI components:

import Accordion from '@yoopta/accordion';
import type { PluginElementRenderProps } from '@yoopta/editor';

const CustomAccordionList = (props: PluginElementRenderProps) => {
  return (
    <div {...props.attributes} className="my-custom-accordion">
      {props.children}
    </div>
  );
};

const CustomAccordionItem = (props: PluginElementRenderProps) => {
  return (
    <details {...props.attributes} className="my-custom-item">
      {props.children}
    </details>
  );
};

const plugins = [
  Accordion.extend({
    elements: {
      'accordion-list': { render: CustomAccordionList },
      'accordion-list-item': { render: CustomAccordionItem },
      'accordion-list-item-heading': { render: CustomAccordionHeading },
      'accordion-list-item-content': { render: CustomAccordionContent },
    },
  }),
];

API

Plugin Type

type AccordionElementMap = {
  'accordion-list': AccordionListElement;
  'accordion-list-item': AccordionItemElement;
  'accordion-list-item-heading': AccordionListItemHeadingElement;
  'accordion-list-item-content': AccordionListItemContentElement;
};

Commands

import { AccordionCommands } from '@yoopta/accordion';
[TODO]

Extend Options

Accordion.extend({
  // Apply UI theme
  elements: AccordionElements,

  // Allow nested plugins (in heading and content)
  injectElementsFromPlugins: [Paragraph, Headings, Lists, Image],

  // Custom options
  options: {
    display: {
      title: 'Custom Accordion',
      description: 'My custom accordion',
    },
    shortcuts: ['accordion', 'collapse'],
  },

  // Custom events
  events: {
    onKeyDown(editor, slate, { hotkeys, currentBlock }) {
      return (event) => {
        // Custom keyboard handling
      };
    },
  },
});

Styling

With UI/Base

Override default styles:

.yoopta-accordion-list {
  margin: 2rem 0;
}

.yoopta-accordion-list-item {
  background: #1a1a1a;
  border-radius: 0.5rem;
}

With Custom CSS

const plugins = [
  Accordion.extend({
    options: {
      HTMLAttributes: {
        className: 'my-accordion',
      },
    },
  }),
];

Architecture

See UI-ARCHITECTURE.md for detailed information about:

  • Headless plugin structure
  • Creating new UI themes
  • Best practices
  • Styling strategies

Examples

Check out the development workspace and live playground. See Accordion plugin docs.

TypeScript

Full TypeScript support with type-safe element configurations.

import type { AccordionElementMap } from '@yoopta/accordion';
import type { YooptaPlugin } from '@yoopta/editor';

const accordionPlugin: YooptaPlugin<AccordionElementMap> = Accordion.extend({
  // Type-safe configuration
});

License

MIT


Made with ❤️ for Yoopta Editor