Default
<Viewer template={Default} /><clover-viewer template="default">98 kB loaded by a page with the Viewer in Default to first view, styles included, gzipped126 kB loaded by a page with a <clover-viewer> in Default to first view, styles included, gzipped
The Viewer’s own layout: the title over the Body, the thumbnails under it, and the information panel beside them, as in Clover 3.x.
import Viewer from "@nulib/clover";
import { Default } from "@nulib/clover/templates";
import "@nulib/clover/styles.css";
<Viewer
iiifContent="https://clover.iiif.library.northwestern.edu/mocks/paged/manifest.json"
template={}
items=
panelLayout=
header={}
/>;<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=
panel-layout=
header="">
</clover-viewer>API reference
The Viewer draws Default when it is given no template. Over the Body are the title and
the provider’s logo; opened on a Collection, the Collection’s title is under the
Manifest’s, with a pager among its members. Under the Body, the thumbnails, headed by the
titles of the current view and where it is among them. A Manifest of one view
has no thumbnails unless singleItemsingle-item asks for them.
The information panel is beside all three, the layout’s full height, and a bar between
shares the width: drag it, or use the arrow keys on it. Where there is no room for both,
on a phone, the panel slides over the Body instead, and a press beside it, Escape or its
close button puts it away. Size the Body with --clover-body-height.
<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.
Examples
Thumbnails
Use items to lay the thumbnails under the Body out as a slider, a list or a grid, or
false to leave them out.
<Viewer iiifContent={url} items="slider" /><clover-viewer
iiif-content="https://clover.iiif.library.northwestern.edu/mocks/paged/manifest.json"
items="slider"></clover-viewer><Viewer iiifContent={url} items="list" /><clover-viewer
iiif-content="https://clover.iiif.library.northwestern.edu/mocks/paged/manifest.json"
items="list"></clover-viewer><Viewer iiifContent={url} items="grid" /><clover-viewer
iiif-content="https://clover.iiif.library.northwestern.edu/mocks/paged/manifest.json"
items="grid"></clover-viewer><Viewer iiifContent={url} items={false} /><clover-viewer
iiif-content="https://clover.iiif.library.northwestern.edu/mocks/paged/manifest.json"
items="false"></clover-viewer>One view
Use singleItemsingle-item to show the thumbnails even where the resource has one view, which has
nothing to choose between.
<Viewer iiifContent={url} singleItem /><clover-viewer
iiif-content="https://clover.iiif.library.northwestern.edu/mocks/navplace/manifest.json"
single-item></clover-viewer>Header and panel
Use header={false}header="false" to leave out the title over the Body, and panel={false}panel="false" to leave
out the information panel and its toggle. defaultPanelOpenpanel-open starts the panel open or
closed beside the Body. On a phone, where it would cover the Body, it starts closed
whatever you pass, and its toggle opens it.
<Viewer
iiifContent="https://api.dc.library.northwestern.edu/api/v2/works/d8fb6329-f7fb-48bf-8bb7-70a64ded5a15?as=iiif"
header={false}
panel={false}
/><clover-viewer
iiif-content="https://api.dc.library.northwestern.edu/api/v2/works/d8fb6329-f7fb-48bf-8bb7-70a64ded5a15?as=iiif"
header="false"
panel="false"></clover-viewer>Fill
Use fill to have the Viewer fill a box of a set height, the window under a page’s own
header, say. The Body takes what the title and the thumbnails leave, never less than
16rem; a shorter box scrolls.
<div style={{ height: "34rem" }}>
<Viewer
iiifContent="https://api.dc.library.northwestern.edu/api/v2/works/0e66d6d8-5dc5-4686-b056-d18682c79ebf?as=iiif"
fill
/>
</div><div style="height: 34rem">
<clover-viewer
iiif-content="https://api.dc.library.northwestern.edu/api/v2/works/0e66d6d8-5dc5-4686-b056-d18682c79ebf?as=iiif"
fill></clover-viewer>
</div>