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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@cas-smartdesign/virtual-list

v6.3.0

Published

A virtualized list element with SmartDesign look and feel.

Downloads

105

Readme

@cas-smartdesign/virtual-list

A list element with ui-virtualization and infinite scrolling.

Attributes

  • item-height
    • Defines the height in px of the list items.
  • item-count
    • Defines the virtual number of items in the list.
  • selection-type
    • Defines the mode of selection handling
    • Available values: "trigger-only", "single", "multi"
  • focus-index
    • Defines the index of currently focused item
  • role: string
    • Aria attribute, default value is "list"

Properties

The following properties are available:

  • items any[] (default=empty)
    • Contains data for the currently rendered list items.
  • itemGenerator ItemGenerator (default is the generator inside the list-item element)
    • A method that renders the list items.
  • itemHeight number (default=50)
    • Reflects the corresponding attribute
  • itemCount number (default=0)
    • Reflects the corresponding attribute
  • selectionType string (default="trigger-only")
    • Reflects the corresponding attribute
  • focusIndex number (default=undefined)
    • Reflects the corresponding attribute
  • selectedIndices number[] (default=empty)
    • Contains the indices of the selected items.

Custom events

  • data-request
    • Sent after scrolling the list
    • Contains the starting and ending index that is visible in the list
  • selection
    • Dispatched when one of the items is selected/deselected
    • Contains the index of the item and a selected flag which is when false indicates that the item is deselected
    • The hasModifier property is true if mouse wheel or ctrl/meta key is down while selection. Note that the auto scroll feature is disabled while middle mouse click.

Public methods

  • getListItem
    • Returns the DOM node that represents the item with the given index
    • Note that only visible items can be accessed this way
  • scrollToItem
    • Scrolls the list to the item with the given index
  • increaseWidthOnNextRenderIfNeeded
    • The width of the list is increased on the next rendering phase to an extent, that all texts in the list-items are visible without ellipsis.
    • If the list has already reached it's maximum width, then line clamp may be enabled on the items to wrap the content if possible.
    • Note that this functionality works only if sd-list-items are rendered in the list

A11Y

The default role is listbox, with the corresponding option role on the items, since most of the time this element is used with a selection state. It ensures the items have an associated id which is used to update aria-activedescendant. The selection is also marked with aria-selected. The items are updated with the aria-setsize & aria-posinset attributes. The former one is -1 if the final size is not known to indicate infinite scrolling state.

Please note that the selection type trigger-only does not provide any accessibility event in case of a selection, but it can be added externally for example with an aria-live area where the content can notify about the selection. Although normally the page would change by such a selection, so it may not be necessary to do this notification.

Attributes managed on items

In addition to above mentioned aria attributes, the items are marked with certain custom attributes:

  • focused
    • Set if the item is currently focused.
  • selected
    • Set if the item is selected.
  • item-index
    • The index of the item.
  • last
    • Set if the item is the last in the currently rendered set of items.