Citation
A numbered inline marker that names its source, with a hover preview of the page it cites.
Attributes
| Name | Type | Default | Description |
|---|---|---|---|
index | number | undefined | — | The source's number, shown in the marker. |
href | string | — | The source's address. Only http(s) and relative addresses become a link. |
source-title | string | — | The cited page's title, shown in the card and announced with the marker. |
snippet | string | — | The passage the text draws on, shown in the card. |
site | string | — | The site's name, shown above the title. Defaults to the address's host. |
favicon | string | — | The site's icon. Only http(s), relative and data:image/ addresses are loaded. |
target | string | _blank | Where the link opens. A citation leaves the page the reader is on, so a new tab by default. |
placement | CitationPlacement | top | Where the card opens beside the marker; it flips when there is no room. |
open-delay | number | 300 | Milliseconds the pointer rests on the marker before the card opens. |
Slots
| Name | Description |
|---|---|
(default) | Replaces the marker's text (index), such as a site name. |
preview | Replaces the card's content. |
CSS parts
Shadow DOM styling hooks used with ::part(name). Prefer CSS custom properties when they cover the change.
| Name | Description |
|---|---|
marker | Component-owned marker region: a link to the source, or a button when there is no address to follow. It holds the default slot, whose fallback is the index number; assigned content, such as a site name, takes its place inside the marker's pill. |
card | The preview card, a c2-hover-card. |
source | The card's first line: the site's icon and name. |
favicon | The site's icon. |
site | The site's name. |
title | The page's title. |
snippet | The quoted passage. |
url | The address, at the foot of the card. |
CSS custom properties
Grouped by semantic target and state from --c2-<component>__<target>__<state>--<property>. Click a group to collapse it; click a name to copy it.
| Name | Type | Default | Description |
|---|---|---|---|
--c2-citation__marker--min-width | pixel | 16px | |
--c2-citation__marker--height | pixel | 16px | |
--c2-citation__marker--padding | padding | 0 4px | |
--c2-citation__marker--border-radius | border-radius | 4px | |
--c2-citation__marker--background-color | color | #f4f4f5 | |
--c2-citation__marker--color | color | #52525b | |
--c2-citation__marker--font-size | font-size | 11px | |
--c2-citation__marker--font-weight | font-weight | 500 | |
--c2-citation__marker--vertical-align | length | 0.15em | How far the marker rises above the baseline of the text it sits in. |
--c2-citation__marker__hover--background-color | color | #e4e4e7 | |
--c2-citation__marker__hover--color | color | #18181b | |
--c2-citation__marker__focus--outline | outline | 2px solid rgba(2, 101, 220, 0.4) | |
--c2-citation__card--width | pixel | 300px | |
--c2-citation__card--padding | padding | 12px | Space inside the card. |
--c2-citation__card--gap | pixel | 6px | Space between the card's lines. |
--c2-citation__favicon--size | pixel | 16px | |
--c2-citation__favicon--border-radius | border-radius | 4px | |
--c2-citation__site--color | color | #71717a | |
--c2-citation__site--font-size | font-size | 12px | |
--c2-citation__title--color | color | #18181b | |
--c2-citation__title--font-size | font-size | 14px | |
--c2-citation__title--font-weight | font-weight | 600 | |
--c2-citation__snippet--color | color | #52525b | |
--c2-citation__snippet--font-size | font-size | 13px | |
--c2-citation__snippet--line-clamp | number | 3 | Most lines of the snippet before it is cut with an ellipsis. |
--c2-citation__url--color | color | #71717a | |
--c2-citation__url--font-size | font-size | 12px | |
Text and languages
The text the component shows, in English. It shows another language when the app adds one with addTranslations, under citation, and the nearest lang asks for it; any message not translated stays in English. {0}, {1}… stand for the values a message carries. Languages guide.
| Key | English | Values |
|---|---|---|
source | Source | — |
numbered | Source {0} | {0} index |
named | {0}: {1} | {0} source {1} title |