Gallery
<Viewer template={Gallery} /><clover-viewer template="gallery">56 kB loaded by a page with the Viewer in Gallery to first view, styles included, gzipped129 kB loaded by a page with a <clover-viewer> in Gallery to first view, styles included, gzipped
A grid framed by what it opens: a Manifest’s views, a Collection’s members, or a page of annotations. Each cell opens in a lightbox, within the gallery’s own bounds.
import Viewer from "@nulib/clover";
import { Gallery } from "@nulib/clover/templates";
import "@nulib/clover/styles.css";
import "@nulib/clover/templates.css";
<Viewer
iiifContent="https://clover.iiif.library.northwestern.edu/mocks/paged/manifest.json"
template={}
items=
height="vh"
size="rem"
secondary=
/>;<script type="module">
import "@nulib/clover/web-components";
</script>
<clover-viewer
iiif-content="https://clover.iiif.library.northwestern.edu/mocks/paged/manifest.json"
template=
items=
height="vh"
size="rem"
secondary=>
</clover-viewer>API reference
Opened on a Manifest, its title and summary head the grid, a cell for each view (a spread is one cell). Opened on a Collection, the Collection’s own title and summary head it, a cell for each member; choosing one shows that Manifest in the lightbox. Opened on an AnnotationPage of tags across Manifests, its label heads the grid, a cell for each tag, its region cut from its view; choosing one shows its Manifest in the lightbox, framed on the tag, and the lightbox’s strip steps through the tags. The grid is inside the gallery’s inset, its cells the inset apart.
The lightbox is a layer over the gallery, filling its bounds: modal within it, the rest of
the gallery out of reach while it is open. Its title is the Manifest’s label, with Back
before it, a step back out to the grid, named for where it goes (the Collection, or the
annotations’ page, where the gallery opened on one), and Close after it. Under its view, the view’s own label,
then a short strip of thumbnails that moves on, focus on the view shown, so the arrow keys go on at
once; or, with lightboxItems="pager"lightbox-items="pager", Previous and Next, focus on Close. Beside its view is the information panel, as Default’s and Document’s is beside theirs: docked where there is room, its toggle on the bar, and sliding over the view where there is not. Escape, Close or
a press outside its panel closes it too, and focus goes back to the cell. Its Body loads
as the pointer or focus first reaches the gallery.
<clover-viewer>
Clover's Viewer, in one of its templates: Default (the title over the Body, the thumbnails under it, the information panel beside them), Document (a PDF reader's pages, thumbnails beside them) or Gallery (a grid, each item opening in a lightbox). Each template loads when used, its styles with it.
The lightbox fills the gallery’s bounds by default. Give it room, a backdrop and corners
with three properties, set on the gallery or any element around it:
--clover-template-lightbox-inset (default 0), --clover-template-lightbox-backdrop
(transparent) and --clover-template-lightbox-radius (0).
Examples
Masonry
Use items="masonry" for pictures at their own proportions, each packed up under the one
above it, still read left to right.
<Viewer iiifContent={url} template={Gallery} items="masonry" /><clover-viewer
iiif-content="https://clover.iiif.library.northwestern.edu/mocks/paged/manifest.json"
template="gallery"
items="masonry"></clover-viewer>A Collection
Opened on a Collection, the gallery is the Collection’s: its title and summary, and a cell for each member, its summary under its label.
<Viewer iiifContent={collection} template={Gallery} />Size
Use size to set the width of the cells.
<Viewer iiifContent={url} template={Gallery} size="8rem" /><clover-viewer
iiif-content="https://clover.iiif.library.northwestern.edu/mocks/paged/manifest.json"
template="gallery"
size="8rem"></clover-viewer>The lightbox’s pager
Use lightboxItems="pager"lightbox-items="pager" for Previous, the position and Next under the lightbox’s view,
in place of its strip of thumbnails.
<Viewer iiifContent={url} template={Gallery} lightboxItems="pager" /><clover-viewer
iiif-content="https://clover.iiif.library.northwestern.edu/mocks/paged/manifest.json"
template="gallery"
lightbox-items="pager"></clover-viewer>A height of its own
Use height to hold the gallery to a height: its header stays, and the grid scrolls under
it. The lightbox fills that height.
<Viewer iiifContent={url} template={Gallery} height="28rem" /><clover-viewer
iiif-content="https://clover.iiif.library.northwestern.edu/mocks/paged/manifest.json"
template="gallery"
height="28rem"></clover-viewer>Gap
Use gap to set the space between cells, the gallery’s inset unless set.
<Viewer iiifContent={url} template={Gallery} gap="0.5rem" /><clover-viewer
iiif-content="https://clover.iiif.library.northwestern.edu/mocks/paged/manifest.json"
template="gallery"
gap="0.5rem"></clover-viewer>The lightbox with a backdrop
Give the lightbox room around its panel and a backdrop, so the gallery shows dimmed around it.
<Viewer
iiifContent={url}
template={Gallery}
style={{
"--clover-template-lightbox-inset": "var(--clover-inset)",
"--clover-template-lightbox-backdrop": "rgb(0 0 0 / 0.6)",
"--clover-template-lightbox-radius": "var(--clover-radius)",
}}
/><clover-viewer
iiif-content="https://clover.iiif.library.northwestern.edu/mocks/paged/manifest.json"
template="gallery"
style="
--clover-template-lightbox-inset: var(--clover-inset);
--clover-template-lightbox-backdrop: rgb(0 0 0 / 0.6);
--clover-template-lightbox-radius: var(--clover-radius);
"></clover-viewer>