0.0.2 • Published 2 years ago

react-flex-images-yh v0.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

react-flex-images npm

A lightweight react wrapper for creating fluid galleries as seen on Flickr and Google Images, based on Pixabay/JavaScript-flexImages.

English | 简体中文

✨ Features

  • Lightweight: 4.8 kB of JavaScript - less than 1.8 kB gzipped
  • Source images/objects can have any size
  • Responsive
  • Equal margins between images controlled via CSS
  • No cropping or reordering
  • AJAX ready, e.g. for infinite scrolling
  • Layout options to control e.g. the maximum number of rows - or whether or not to display an incomplete (last) row.

📃 Example

Preview

EditOnCodeSanbox

📦 Install

$ npm install react-flex-images

🔨 Usage

import { FlexImagesContainer, FlexImagesItem } from "react-flex-images";

const App = () => (
  <>
    <FlexImagesContainer rowHeight={300} maxRows={20} truncate>
        <FlexImagesItem imgUrl="..." imgWidth={...} imgHeight={...} />
        <FlexImagesItem imgUrl="..." imgWidth={...} imgHeight={...} />
        ...
    </FlexImagesContainer>
  </>
);

Settings

PropertyDefaultDescription
rowHeight300Maximum height of a row.
maxRowsnullMaximum number of rows to display. Images/Objects exceeding this row are hidden.
truncatefalseHide incomplete last row of images/objects.