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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@shortcm/image-list

v0.44.1

Published

The Material Components for the web image list component

Downloads

2

Readme

Image List

MDC Image List provides a RTL-aware Material Design image list component. An Image List consists of several items, each containing an image and optionally supporting content (i.e. a text label).

Design & API Documentation

Installation

npm install @material/image-list

Basic Usage

HTML Structure

The HTML structure for a Standard Image List is as follows:

<ul class="mdc-image-list my-image-list">
  <li class="mdc-image-list__item">
    <div class="mdc-image-list__image-aspect-container">
      <img class="mdc-image-list__image" src="...">
    </div>
    <div class="mdc-image-list__supporting">
      <span class="mdc-image-list__label">Text label</span>
    </div>
  </li>
  ...
</ul>

Styles

@import "@material/image-list/mdc-image-list";

The HTML structure above would be combined with an invocation of the mdc-image-list-standard-columns mixin, to establish how many columns should be displayed per line:

.my-image-list {
  @include mdc-image-list-standard-columns(5);
}

Images in a Standard Image list are constrained to 1:1 aspect ratio by default; this can be overridden using the mdc-image-list-aspect mixin documented below.

Variants

Masonry Image List

The Masonry Image List variant presents images vertically arranged into several columns, using CSS Columns. In this layout, images may be any combination of aspect ratios.

<ul class="mdc-image-list mdc-image-list--masonry my-masonry-image-list">
  <li class="mdc-image-list__item">
    <img class="mdc-image-list__image" src="...">
    <div class="mdc-image-list__supporting">
      <span class="mdc-image-list__label">Text label</span>
    </div>
  </li>
  ...
</ul>

Note: Masonry Image List items do not include the mdc-image-list__image-aspect-container element, since images in the list are not expected to be locked to a common aspect ratio.

This would be combined with an invocation of the mdc-image-list-masonry-columns mixin, to establish how many columns should be displayed:

.my-masonry-image-list {
  @include mdc-image-list-masonry-columns(5);
}

Style Customization

CSS Classes

CSS Class | Description --- | --- mdc-image-list | Mandatory. Indicates the root Image List element. mdc-image-list--masonry | Optional. Indicates that this Image List should use the Masonry variant. mdc-image-list--with-text-protection | Optional. Indicates that supporting content should be positioned in a scrim overlaying each image (instead of positioned separately under each image). mdc-image-list__item | Mandatory. Indicates each item in an Image List. mdc-image-list__image-aspect-container | Optional. Parent of each item's image element, responsible for constraining aspect ratio. This element may be omitted entirely if images are already sized to the correct aspect ratio. mdc-image-list__image | Mandatory. Indicates the image element in each item. mdc-image-list__supporting | Optional. Indicates the area within each item containing the supporting text label, if the Image List contains text labels. mdc-image-list__label | Optional. Indicates the text label in each item, if the Image List contains text labels.

Sass Mixins

Mixin | Description --- | --- mdc-image-list-aspect($width-height-ratio) | Styles the aspect container elements within an Image List to conform to the given ratio, where 1 is 1:1, greater than 1 is wider, and less than 1 is taller. mdc-image-list-shape-radius($radius, $rtl-reflexive) | Sets the rounded shape to image list item with given radius size. Set $rtl-reflexive to true to flip radius values in RTL context, defaults to false. mdc-image-list-standard-columns($column-count, $gutter-size) | Styles a Standard Image List to display the given number of columns. $gutter-size is optional and overrides the default amount of space between items. mdc-image-list-masonry-columns($column-count, $gutter-size) | Styles a Masonry Image List to display the given number of columns. $gutter-size is optional and overrides the default amount of space between items.

Note: Only one of the mdc-image-list-...-columns mixins should be used for any given Image List. Use the mixin appropriate to the variant being used.

Additional Information

Constraining width

The mdc-image-list-...-columns mixins will grow and shrink items based on the Image List's overall width. Depending on placement, this could be directly related to the viewport width, and images could become exceedingly large compared to their actual rendered size. This can be restricted by using any of min-width, width, or max-width on the Image List:

.my-image-list {
  @include mdc-image-list-standard-columns(5);
  max-width: 960px;
}

Note: Remember that any specified width will apply to the entire list, so be sure to account for the gutters as well.

Changing number of columns across breakpoints

Presenting a different number of columns for different viewport sizes is straightforward, since the only thing that needs to be changed are styles:

.my-image-list {
  @include mdc-image-list-standard-columns(5);
}

@media (max-width: 599px) {
  .my-image-list {
    @include mdc-image-list-standard-columns(3);
  }
}

Using div in place of img to enforce aspect ratio

Note: This advice is not applicable to Masonry Image List, where images do not share a common aspect ratio.

Images in an Image List typically use the img element. However, if your assets don't have the same aspect ratio as specified for list items, they will become distorted. In these cases, you can use a div element in place of img, and set the background-image of each.

Note: Ensuring your images are appropriately-sized prior to serving them to browsers is the most efficient and ideal approach to using MDC Image List. The div alternative is provided as a convenience. If you use this alternative, make sure to also include the mdc-image-list__image-aspect-container element around each item's image.