3.1.0 • Published 1 year ago

react-film v3.1.0

Weekly downloads
6,841
License
MIT
Repository
github
Last release
1 year ago

react-film

npm version Build Status

React component for showing carousel just like a film strip.

This project scaffolding is from react-component-template.

Demo

Try out our demo at https://spyip.github.io/react-film/.

Sample code

<BasicFilm height={ 316 }>
  <img alt="Cat 01" src="image/01.jpg" />
  <img alt="Cat 02" src="image/02.jpg" />
  <img alt="Cat 03" src="image/03.jpg" />
</BasicFilm>

Note: we need to specify height here because there are no CSS rule one can use to hide scroll bars in Firefox.

Features

  • Native horizontal scrolling
    • Virtual scroll bar
    • Optionally, show when hover
    • Support touch scrolling
  • Bring your own flipper
    • Sample: show only when overflow
    • Sample: show when hover
  • Bring your own scrollbar
    • Sample: show only when overflow
    • Sample: show when hover
  • Bring your own dots
    • Sample: show only when overflow
  • Variable container width
    • Users can resize the container width any time they want
  • Variable item width:
    • Users can resize item width any time they want
    • Item may resize itself from time to time (consider when the image is not loaded)
  • Minimal styling as possible, let user customize it
  • Support keyboard left/right arrow (supported natively)

Props

NameDefaultDescription
heightnumberHeight of the carousel

Context

NameTypeDescription
filmStripDOMElementInternal use: DOM element for the film strip
numItemsnumberNumber of items in the carousel
scrollBarLeftstringOffset left (in percentage) of the scroll bar
scrollBarWidthstringWidth (in percentage) of the scroll bar, respective to its total content
scrollingbooleantrue if the user is scrolling (debounced from onScroll event), otherwise, false
scrollLeftnumberInternal use: offset left to scroll to
scrollTo(({ indexFraction: number }) => {}) => {}Scroll to a specified index, given the current index (in fraction)
scrollToLeft() => {}Scroll one element left
scrollToRight() => {}Scroll one element right
setFilmStripRef(DOMElement) => {}Internal use: set the DOM element for the film strip
setNumItems(number) => {}Internal use: set the number of items in the carousel

Contributions

Like us? Star us.

Want to make it better? File us an issue.

Don't like something you see? Submit a pull request.

3.1.0

3 years ago

3.0.1

3 years ago

3.0.0

4 years ago

2.1.0

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.3.0

4 years ago

1.2.0

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.0

6 years ago

0.0.1-0

6 years ago