
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
@ampproject/amp-inline-gallery
Advanced tools
The Bento Inline Gallery component uses a Bento Carousel component to display slides, with optional pagination dots and thumbnails. Both components must be properly installed for the environment (Web Component vs Preact).
You must include each Bento component's required CSS library to guarantee proper loading and before adding custom styles. Or use the light-weight pre-upgrade styles available inline. See Layout and style.
The examples below demonstrate use of the <bento-inline-gallery>
web component.
[example preview="top-frame" playground="false"]
Install via npm:
npm install @ampproject/bento-inline-gallery
import '@ampproject/bento-inline-gallery';
[/example]
<script>
The example below contains a bento-inline-gallery
consisting of three slides with thumbnails and a pagination indicator.
[example preview="top-frame" playground="false"]
<head>
<script src="https://cdn.ampproject.org/custom-elements-polyfill.js"></script>
<script async src="https://cdn.ampproject.org/v0/bento-inline-gallery-1.0.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.ampproject.org/v0/amp-inline-gallery-1.0.css">
</head>
<body>
<bento-inline-gallery id="inline-gallery">
<bento-inline-gallery-thumbnails aspect-ratio="1.5" loop></bento-inline-gallery-thumbnails>
<bento-base-carousel snap-align="center" visible-count="1.2" loop>
<img src="server.com/static/inline-examples/images/image1.jpg">
<img src="server.com/static/inline-examples/images/image2.jpg">
<img src="server.com/static/inline-examples/images/image3.jpg">
</bento-base-carousel>
<bento-inline-gallery-pagination inset></bento-inline-gallery-pagination>
</bento-inline-gallery>
</body>
[/example]
Each Bento component has a small CSS library you must include to guarantee proper loading without content shifts. Because of order-based specificity, you must manually ensure that stylesheets are included before any custom styles.
<link rel="stylesheet" type="text/css" href="https://cdn.ampproject.org/v0/amp-inline-gallery-1.0.css">
Alternatively, you may also make the light-weight pre-upgrade styles available inline:
<style data-bento-boilerplate>
amp-inline-gallery,
amp-inline-gallery-pagination,
amp-inline-gallery-thumbnails {
display: block;
}
amp-inline-gallery {
contain: layout;
}
amp-inline-gallery-pagination,
amp-inline-gallery-thumbnails {
overflow: hidden;
position: relative;
}
</style>
<bento-inline-gallery-pagination>
inset
Default: false
Boolean attribute indicating whether to display the pagination indicator as inset (overlaying the carousel itself)
<bento-inline-gallery-thumbnails>
aspect-ratio
Optional
Number: ratio of width to height that slides should be displayed in.
loop
Default: false
Boolean attribute indicating whether thumbnails should loop.
You may use the bento-inline-gallery
, bento-inline-gallery-pagination
, bento-inline-gallery-thumbnails
, and bento-base-carousel
element selectors to style the pagination indicator, thumbnails, and carousel freely.
The examples below demonstrates use of the <BentoInlineGallery>
as a functional component usable with the Preact or React libraries.
[example preview="top-frame" playground="false"]
Install via npm:
npm install @ampproject/bento-inline-gallery
import React from 'react';
import { BentoInlineGallery } from '@ampproject/bento-inline-gallery/react';
import '@ampproject/bento-inline-gallery/styles.css';
function App() {
return (
<BentoInlineGallery id="inline-gallery">
<BentoInlineGalleryThumbnails aspect-ratio="1.5" loop></BentoInlineGalleryThumbnails>
<BentoBaseCarousel snap-align="center" visible-count="1.2" loop>
<img src="server.com/static/inline-examples/images/image1.jpg">
<img src="server.com/static/inline-examples/images/image2.jpg">
<img src="server.com/static/inline-examples/images/image3.jpg">
</BentoBaseCarousel>
<BentoInlineGallery-pagination inset></BentoInlineGallery-pagination>
</BentoInlineGallery>
}
[/example]
Container type
The BentoInlineGallery
component has a defined layout size type. To ensure the component renders correctly, be sure to apply a size to the component and its immediate children via a desired CSS layout (such as one defined with width
). These can be applied inline:
<BentoInlineGallery style={{width: '300px'}}>
...
</BentoInlineGallery>
Or via className
:
<BentoInlineGallery className='custom-styles'>
...
</BentoInlineGallery>
.custom-styles {
background-color: red;
}
In addition to the common props, BentoInlineGalleryPagination supports the props below:
inset
Default: false
Boolean attribute indicating whether to display the pagination indicator as inset (overlaying the carousel itself)
In addition to the common props, BentoInlineGalleryThumbnails supports the props below:
aspectRatio
Optional
Number: ratio of width to height that slides should be displayed in.
loop
Default: false
Boolean attribute indicating whether thumbnails should loop.
FAQs
AMP HTML amp-inline-gallery Component
The npm package @ampproject/amp-inline-gallery receives a total of 0 weekly downloads. As such, @ampproject/amp-inline-gallery popularity was classified as not popular.
We found that @ampproject/amp-inline-gallery demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 16 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.