|
| 1 | +--- |
| 2 | +title: Rendering |
| 3 | +--- |
| 4 | + |
| 5 | +import IIIFBadge from "docs/components/IIIFBadge"; |
| 6 | +import { Rendering } from "src/components/Primitives"; |
| 7 | +import { Tabs, Tab } from "nextra/components"; |
| 8 | + |
| 9 | +# Rendering |
| 10 | + |
| 11 | +The Rendering component is used to display a list of alternate formats related to a resource. Whereas SeeAlso is used |
| 12 | +to link to a machine-readable resource such as metadata, the Rendering component alerts users that the resource is |
| 13 | +available in another format such as PDF or ePub or has a related format. Because of the wide variety of formats that |
| 14 | +resources can be available in, the Rendering component is flexible and be of any media type and contain any type of |
| 15 | +data. |
| 16 | + |
| 17 | +<IIIFBadge |
| 18 | + href="https://iiif.io/api/presentation/3.0/#rendering" |
| 19 | + text={["rendering"]} |
| 20 | +/> |
| 21 | + |
| 22 | +<Tabs items={["Code", "Example", "HTML"]}> |
| 23 | + <Tab> |
| 24 | + ```jsx |
| 25 | + <Rendering |
| 26 | + rendering={[ |
| 27 | + { |
| 28 | + id: "https://fixtures.iiif.io/other/UCLA/kabuki_ezukushi_rtl.pdf", |
| 29 | + type: "Text", |
| 30 | + label: { |
| 31 | + en: ["PDF version"], |
| 32 | + }, |
| 33 | + format: "application/pdf", |
| 34 | + }, |
| 35 | + ]} |
| 36 | + /> |
| 37 | + ``` |
| 38 | + </Tab> |
| 39 | + <Tab> |
| 40 | + <Rendering |
| 41 | + rendering={[ |
| 42 | + { |
| 43 | + id: "https://fixtures.iiif.io/other/UCLA/kabuki_ezukushi_rtl.pdf", |
| 44 | + type: "Text", |
| 45 | + label: { |
| 46 | + en: ["PDF version"], |
| 47 | + }, |
| 48 | + format: "application/pdf", |
| 49 | + }, |
| 50 | + ]} |
| 51 | + /> |
| 52 | + </Tab> |
| 53 | + <Tab> |
| 54 | + ```html |
| 55 | + <ul class="c-PJLV"> |
| 56 | + <li class="c-PJLV"> |
| 57 | + <a |
| 58 | + href="https://fixtures.iiif.io/other/UCLA/kabuki_ezukushi_rtl.pdf" |
| 59 | + target="_blank" |
| 60 | + > |
| 61 | + PDF version |
| 62 | + </a> |
| 63 | + </li> |
| 64 | + </ul> |
| 65 | + ``` |
| 66 | + </Tab> |
| 67 | +</Tabs> |
| 68 | + |
| 69 | +## Usage |
| 70 | + |
| 71 | +### React |
| 72 | + |
| 73 | +```jsx |
| 74 | +import { Rendering } from "@samvera/clover-iiif/primitives"; |
| 75 | + |
| 76 | +const CustomRendering = ({ rendering }) => { |
| 77 | + return <Rendering rendering={rendering} />; |
| 78 | +}; |
| 79 | + |
| 80 | +export default CustomRendering; |
| 81 | +``` |
| 82 | + |
| 83 | +## API Reference |
| 84 | + |
| 85 | +| Prop | Type | Default | Required | |
| 86 | +| ----------- | ------------------------------------------------------------ | ------- | -------- | |
| 87 | +| `as` | `ol`, `ul` | `ul` | -- | |
| 88 | +| `rendering` | [rendering](https://iiif.io/api/presentation/3.0/#rendering) | -- | **Yes** | |
| 89 | +| `className` | `string`, `undefined` | -- | -- | |
| 90 | +| `style` | `CSSProperties`, `undefined` | -- | -- | |
| 91 | +| `lang` | `string`, `undefined` | -- | -- | |
| 92 | +| `title` | `string`, `undefined` | -- | -- | |
| 93 | +| `data-*` | `string`, `undefined` | -- | -- | |
| 94 | +| `aria-*` | `AriaAttributes`, `undefined` | -- | -- | |
| 95 | + |
| 96 | +### Custom Element |
| 97 | + |
| 98 | +The `Rendering` component can be rendered as either `ol` or `ul` elements. The default is `ul`. |
| 99 | + |
| 100 | +<Tabs items={["Code", "Example", "HTML"]}> |
| 101 | + <Tab> |
| 102 | + ```jsx |
| 103 | + <Rendering |
| 104 | + rendering={[ |
| 105 | + { |
| 106 | + id: "https://fixtures.iiif.io/other/UCLA/kabuki_ezukushi_rtl.pdf", |
| 107 | + type: "Text", |
| 108 | + label: { |
| 109 | + en: ["PDF version"], |
| 110 | + }, |
| 111 | + format: "application/pdf", |
| 112 | + }, |
| 113 | + ]} |
| 114 | + as="ol" |
| 115 | + /> |
| 116 | + ``` |
| 117 | + </Tab> |
| 118 | + <Tab> |
| 119 | + <Rendering |
| 120 | + rendering={[ |
| 121 | + { |
| 122 | + id: "https://fixtures.iiif.io/other/UCLA/kabuki_ezukushi_rtl.pdf", |
| 123 | + type: "Text", |
| 124 | + label: { |
| 125 | + en: ["PDF version"], |
| 126 | + }, |
| 127 | + format: "application/pdf", |
| 128 | + }, |
| 129 | + ]} |
| 130 | + as="ol" |
| 131 | + /> |
| 132 | + </Tab> |
| 133 | + <Tab> |
| 134 | + ```html |
| 135 | + <ol class="c-PJLV"> |
| 136 | + <li class="c-PJLV"> |
| 137 | + <a href="https://fixtures.iiif.io/other/UCLA/kabuki_ezukushi_rtl.pdf"> |
| 138 | + PDF version |
| 139 | + </a> |
| 140 | + </li> |
| 141 | + </ol> |
| 142 | + ``` |
| 143 | + </Tab> |
| 144 | +</Tabs> |
0 commit comments