0.17.7 • Published 7 months ago
@k8slens/lds-carousel v0.17.7
Lens Design System – React Carousel component
Documentation
Browse the documentation at lens-design-system.k8slens.dev.
Usage in React apps
- run
npm i -s @k8slens/lds @k8slens/lds-tokens @k8slens/lds-carousel - import
@k8slens/lds-tokens/lib/es/font-imports.cssin your React app to include fonts - import
@k8slens/lds/lib/es/index.cssin your React app to include core styles - import
@k8slens/lds-carousel/lib/es/index.cssin your React app to include Carousel styles - Use in a component:
import Carousel from "@k8slens/lds-carousel";
export const Component = () => (
<Carousel>
<img src="src" alt="Alt text" />
<img src="src" alt="Alt text" />
<img src="src" alt="Alt text" />
</Carousel>
);Autoplay first slide when it's a video
import Carousel from "@k8slens/lds-carousel";
export const Component = () => {
const videoRef = React.useRef<HTMLVideoElement>(null);
const [isVideoPlaying, setIsVideoPlaying] = useState(false);
const [playing, setVideoPlaying] = useState(false);
useEffect(() => {
if (videoRef?.current && playing && !isVideoPlaying) {
videoRef.current.play().catch((e) => {
console.log(e);
});
}
}, [videoRef, playing, isVideoPlaying]);
return (
<Carousel>
<video
key="video-1" // Key needs to include the word "video"
ref={videoRef}
autoPlay={playing}
src="src"
muted // Mute video to avoid autoplay issues
onPlay={() => setIsVideoPlaying(true)}
onPause={() => setIsVideoPlaying(false)}
onEnded={() => setIsVideoPlaying(false)}
/>
<img src="src" alt="Alt text" />
<img src="src" alt="Alt text" />
<img src="src" alt="Alt text" />
</Carousel>
);
}0.17.2
8 months ago
0.17.3
8 months ago
0.17.4
7 months ago
0.17.5
7 months ago
0.17.6
7 months ago
0.17.7
7 months ago
0.13.0
11 months ago
0.11.2
1 year ago
0.11.3
1 year ago
0.15.0
10 months ago
0.15.1
9 months ago
0.17.0
8 months ago
0.15.2
9 months ago
0.17.1
8 months ago
0.15.3
9 months ago
0.12.0
1 year ago
0.12.1
1 year ago
0.14.0
11 months ago
0.12.2
1 year ago
0.14.1
10 months ago
0.12.3
1 year ago
0.16.0
9 months ago
0.14.2
10 months ago
0.12.4
1 year ago
0.14.3
10 months ago
0.12.5
12 months ago
0.11.0
1 year ago
0.11.1
1 year ago
0.10.4
1 year ago
0.10.2
1 year ago
0.10.3
1 year ago
0.9.3
1 year ago
0.10.1
1 year ago
0.10.0
1 year ago
0.3.0
2 years ago
0.1.2
2 years ago
0.2.0
2 years ago
0.1.1
2 years ago
0.9.0
1 year ago
0.7.2
1 year ago
0.5.4
1 year ago
0.8.0
1 year ago
0.7.1
1 year ago
0.6.2
1 year ago
0.5.3
1 year ago
0.9.2
1 year ago
0.9.1
1 year ago
0.7.3
1 year ago
0.5.0
2 years ago
0.4.0
2 years ago
0.7.0
1 year ago
0.6.1
1 year ago
0.5.2
1 year ago
0.6.0
1 year ago
0.5.1
2 years ago
0.1.0
2 years ago