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

@rcarls/rc-splitter

v0.3.2

Published

Resizable pane splitter with pointer, keyboard, and collapse/restore controls.

Readme

@rcarls/rc-splitter

Resizable pane splitter with pointer, keyboard, and collapse/restore controls, following the WAI-ARIA Window Splitter pattern.

Docs: https://richardcarls.github.io/rc-webcomponents/components/rc-splitter.


Installation

npm install @rcarls/rc-splitter

Import

import '@rcarls/rc-splitter';                        // side-effect: registers <rc-splitter>
import { RCSplitter } from '@rcarls/rc-splitter';    // named class export

Basic usage

Place the primary pane in the default slot and the secondary pane in the secondary slot. The splitter takes up the full available space of its container.

<rc-splitter style="width: 100%; height: 400px;">
  <div>Primary pane — resizes when you drag the separator</div>
  <div slot="secondary">Secondary pane — fills remaining space</div>
</rc-splitter>

Vertical orientation:

<rc-splitter orientation="vertical" style="width: 100%; height: 600px;">
  <div>Top pane</div>
  <div slot="secondary">Bottom pane</div>
</rc-splitter>

API

Properties / attributes

| Property | Attribute | Type | Default | Description | |---|---|---|---|---| | label | label | string | 'Splitter' | Accessible label applied to the primary pane and used by the separator handle via aria-labelledby. | | orientation | orientation | 'horizontal' \| 'vertical' | 'horizontal' | Layout direction. horizontal = left/right panes; vertical = top/bottom panes. Reflects to attribute. | | mode | mode | 'length' \| 'percent' | 'length' | Unit for value. length = pixels of the primary pane; percent = percentage of total container size. | | step | step | number | 1 | Keyboard step size in the current unit (px or %). Shift multiplies by 10×. | | value | — | number \| null | null | Initial primary pane size. When null, the pane uses its natural size until first interaction. Setting via property updates the separator position. | | fixed | fixed | boolean | false | Disable resizing. The separator is rendered but non-interactive. |

CSS custom properties

| Property | Default | Description | |---|---|---| | --rc-splitter-separator-size | 6px | Thickness of the separator bar | | --rc-splitter-separator-handle-size | 100% | Length of the drag handle within the separator (set to a smaller value to create a centred grab handle) | | --rc-splitter-separator-color | ButtonFace | Background color of the separator bar | | --rc-splitter-separator-border-inline-start | 1px solid ButtonBorder | Inline-start (left in LTR) border of the separator | | --rc-splitter-separator-border-inline-end | 1px solid ButtonBorder | Inline-end (right in LTR) border of the separator | | --rc-splitter-separator-border-block-start | 1px solid ButtonBorder | Block-start (top) border when orientation="vertical" | | --rc-splitter-separator-border-block-end | 1px solid ButtonBorder | Block-end (bottom) border when orientation="vertical" |

All color defaults use CSS system color keywords so they adapt automatically to the user's color scheme and forced-color modes.

CSS parts

| Part | Element | Description | |---|---|---| | primary | div#primary | Primary pane container | | secondary | aside#secondary | Secondary pane container | | separator | div#separator | The separator bar | | separator-handle | div[role="separator"] inside separator | The focusable drag handle (narrower than the bar if --rc-splitter-separator-handle-size is set) |

Slots

| Slot | Description | |---|---| | (default) | Primary pane. Its inline-size (or block-size when vertical) is set by the splitter. | | secondary | Secondary pane. Fills remaining space via flex: 1. |

Events

| Event | Bubbles | Cancelable | Detail | When | |---|---|---|---|---| | rc-splitter-change | Yes (composed) | No | { value: number, valueText: string } | Separator position changes (on every pointer move or key press) |

Read-only getters

value: number | null            // Current primary pane size in the current mode unit
valueText: string               // Human-readable value string (e.g. "240px" or "40%")

Keyboard behaviour

Focus the separator handle (click or Tab), then:

| Key | Action | |---|---| | ArrowRight / ArrowDown | Increase primary pane by step (horizontal: right; vertical: down) | | ArrowLeft / ArrowUp | Decrease primary pane by step | | Shift + Arrow | Multiply step by 10× | | Home | Collapse primary pane to zero | | End | Expand primary pane to fill all available space | | Enter | Restore last non-collapsed size (if currently collapsed) |


ARIA

The separator handle implements the WAI-ARIA slider role pattern:

| Attribute | Where | Value | |---|---|---| | role="separator" | Separator handle div | — | | aria-label | Primary pane | Value of label property | | aria-orientation | Separator handle | "horizontal" or "vertical" | | aria-valuenow | Separator handle | Current numeric value | | aria-valuemin | Separator handle | 0 | | aria-valuemax | Separator handle | Container width or height in current mode units | | aria-valuetext | Separator handle | Human-readable string (e.g. "240px") | | aria-controls | Separator handle | "primary" — ID of the primary pane | | aria-labelledby | Separator handle | "primary" — uses the primary pane as label context | | tabindex="0" | Separator handle | Always focusable |


Example: percentage mode with a styled separator

<rc-splitter
  mode="percent"
  style="
    width: 100%;
    height: 500px;
    --rc-splitter-separator-size: 4px;
    --rc-splitter-separator-color: ButtonFace;
    --rc-splitter-separator-border-inline-start: none;
    --rc-splitter-separator-border-inline-end: none;
  "
>
  <nav>Sidebar</nav>
  <div slot="secondary">Main content</div>
</rc-splitter>

Browser support

All modern browsers. Requires Web Components support (Chrome 67+, Firefox 63+, Safari 12.1+) and ResizeObserver (Chrome 64+, Firefox 69+, Safari 13.1+).