Components / Tooltips and popovers
Line chart crosshair
A crosshair that follows the hour you point at on a two line chart, with a dot on each line and a tip that names both values and the gap.
- Today
- Last Saturday
- 7:00 to 8:00Today12Last Sat102 more than last week
- 8:00 to 9:00Today31Last Sat265 more than last week
- 9:00 to 10:00Today44Last Sat359 more than last week
- 10:00 to 11:00Today38Last Sat413 fewer than last week
- 11:00 to 12:00Today52Last Sat4012 more than last week
- 12:00 to 13:00Today47Last Sat3611 more than last week
- 13:00 to 14:00Today29Last Sat301 fewer than last week
- 14:00 to 15:00Today18Last Sat224 fewer than last week
The code
Plain HTML and CSS on your kit's variables. Put it next to tokens/variables.css from your kit's files and it draws in your look.
<div class="ukc-tooltip-line-crosshair">
<figure class="chart">
<figcaption>
<span class="ttl">Loaves sold per hour</span>
<ul class="key"><li><i class="sw"></i>Today</li><li><i class="sw dash"></i>Last Saturday</li></ul>
</figcaption>
<div class="area">
<svg viewBox="0 0 300 120" preserveAspectRatio="none" fill="none" aria-hidden="true"><path class="gl" d="M0 10h300M0 60h300M0 110h300"/><polyline class="lb" points="18.75,93.3 56.25,66.7 93.75,51.7 131.25,41.7 168.75,43.3 206.25,50 243.75,60 281.25,73.3"/><polyline class="la" points="18.75,90 56.25,58.3 93.75,36.7 131.25,46.7 168.75,23.3 206.25,31.7 243.75,61.7 281.25,80"/></svg>
<ol class="pts">
<li class="pt lead" style="--a: 75.0%; --b: 77.8%"><button type="button" class="col" aria-label="7:00 to 8:00" aria-describedby="ukc-tooltip-line-crosshair-7"><span class="plot"><span class="rule"></span><span class="dot a"></span><span class="dot b"></span></span><span class="h">7</span></button><span class="tip" role="tooltip" id="ukc-tooltip-line-crosshair-7"><span class="hr">7:00 to 8:00</span><span class="ln"><i class="sw"></i>Today<b>12</b></span><span class="ln"><i class="sw dash"></i>Last Sat<b>10</b></span><span class="dl">2 more than last week</span></span></li>
<li class="pt lead" style="--a: 48.6%; --b: 55.6%"><button type="button" class="col" aria-label="8:00 to 9:00" aria-describedby="ukc-tooltip-line-crosshair-8"><span class="plot"><span class="rule"></span><span class="dot a"></span><span class="dot b"></span></span><span class="h">8</span></button><span class="tip" role="tooltip" id="ukc-tooltip-line-crosshair-8"><span class="hr">8:00 to 9:00</span><span class="ln"><i class="sw"></i>Today<b>31</b></span><span class="ln"><i class="sw dash"></i>Last Sat<b>26</b></span><span class="dl">5 more than last week</span></span></li>
<li class="pt" style="--a: 30.6%; --b: 43.1%"><button type="button" class="col" aria-label="9:00 to 10:00" aria-describedby="ukc-tooltip-line-crosshair-9"><span class="plot"><span class="rule"></span><span class="dot a"></span><span class="dot b"></span></span><span class="h">9</span></button><span class="tip" role="tooltip" id="ukc-tooltip-line-crosshair-9"><span class="hr">9:00 to 10:00</span><span class="ln"><i class="sw"></i>Today<b>44</b></span><span class="ln"><i class="sw dash"></i>Last Sat<b>35</b></span><span class="dl">9 more than last week</span></span></li>
<li class="pt" style="--a: 38.9%; --b: 34.8%"><button type="button" class="col" aria-label="10:00 to 11:00" aria-describedby="ukc-tooltip-line-crosshair-10"><span class="plot"><span class="rule"></span><span class="dot a"></span><span class="dot b"></span></span><span class="h">10</span></button><span class="tip" role="tooltip" id="ukc-tooltip-line-crosshair-10"><span class="hr">10:00 to 11:00</span><span class="ln"><i class="sw"></i>Today<b>38</b></span><span class="ln"><i class="sw dash"></i>Last Sat<b>41</b></span><span class="dl">3 fewer than last week</span></span></li>
<li class="pt show" style="--a: 19.4%; --b: 36.1%"><button type="button" class="col" aria-label="11:00 to 12:00" aria-describedby="ukc-tooltip-line-crosshair-11"><span class="plot"><span class="rule"></span><span class="dot a"></span><span class="dot b"></span></span><span class="h">11</span></button><span class="tip" role="tooltip" id="ukc-tooltip-line-crosshair-11"><span class="hr">11:00 to 12:00</span><span class="ln"><i class="sw"></i>Today<b>52</b></span><span class="ln"><i class="sw dash"></i>Last Sat<b>40</b></span><span class="dl">12 more than last week</span></span></li>
<li class="pt" style="--a: 26.4%; --b: 41.7%"><button type="button" class="col" aria-label="12:00 to 13:00" aria-describedby="ukc-tooltip-line-crosshair-12"><span class="plot"><span class="rule"></span><span class="dot a"></span><span class="dot b"></span></span><span class="h">12</span></button><span class="tip" role="tooltip" id="ukc-tooltip-line-crosshair-12"><span class="hr">12:00 to 13:00</span><span class="ln"><i class="sw"></i>Today<b>47</b></span><span class="ln"><i class="sw dash"></i>Last Sat<b>36</b></span><span class="dl">11 more than last week</span></span></li>
<li class="pt tail" style="--a: 51.4%; --b: 50.0%"><button type="button" class="col" aria-label="13:00 to 14:00" aria-describedby="ukc-tooltip-line-crosshair-13"><span class="plot"><span class="rule"></span><span class="dot a"></span><span class="dot b"></span></span><span class="h">13</span></button><span class="tip" role="tooltip" id="ukc-tooltip-line-crosshair-13"><span class="hr">13:00 to 14:00</span><span class="ln"><i class="sw"></i>Today<b>29</b></span><span class="ln"><i class="sw dash"></i>Last Sat<b>30</b></span><span class="dl">1 fewer than last week</span></span></li>
<li class="pt tail" style="--a: 66.7%; --b: 61.1%"><button type="button" class="col" aria-label="14:00 to 15:00" aria-describedby="ukc-tooltip-line-crosshair-14"><span class="plot"><span class="rule"></span><span class="dot a"></span><span class="dot b"></span></span><span class="h">14</span></button><span class="tip" role="tooltip" id="ukc-tooltip-line-crosshair-14"><span class="hr">14:00 to 15:00</span><span class="ln"><i class="sw"></i>Today<b>18</b></span><span class="ln"><i class="sw dash"></i>Last Sat<b>22</b></span><span class="dl">4 fewer than last week</span></span></li>
</ol>
</div>
</figure>
</div>
.ukc-tooltip-line-crosshair { position: relative; font-family: var(--uk-font-body, system-ui, sans-serif); color: var(--uk-ink); font-size: 15px; line-height: 1.5;
--tint: color-mix(in srgb, var(--uk-accent) 12%, var(--uk-paper));
--tint-strong: color-mix(in srgb, var(--uk-accent) 22%, var(--uk-paper));
--accent-deep: color-mix(in srgb, var(--uk-accent) 72%, black);
--ink-soft: color-mix(in srgb, var(--uk-ink) 8%, var(--uk-paper));
--line-strong: color-mix(in srgb, var(--uk-ink) 32%, var(--uk-paper));
--danger-tint: color-mix(in srgb, var(--uk-danger) 12%, var(--uk-paper));
--high-tint: color-mix(in srgb, var(--uk-highlight) 28%, var(--uk-paper)); }
.ukc-tooltip-line-crosshair *, .ukc-tooltip-line-crosshair *::before, .ukc-tooltip-line-crosshair *::after { box-sizing: border-box; }
.ukc-tooltip-line-crosshair :where(h1, h2, h3, h4, p, ul, ol, dl, dd, figure, blockquote) { margin: 0; }
.ukc-tooltip-line-crosshair :where(ul, ol) { padding: 0; list-style: none; }
.ukc-tooltip-line-crosshair :where(button, input, select, textarea) { font: inherit; color: inherit; }
.ukc-tooltip-line-crosshair :where(a) { color: inherit; }
.ukc-tooltip-line-crosshair svg { flex: none; }
.ukc-tooltip-line-crosshair .chart { margin: 0; max-width: 400px; display: grid; gap: 4px; }
.ukc-tooltip-line-crosshair figcaption { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.ukc-tooltip-line-crosshair .ttl { font-size: 15px; font-weight: 600; }
.ukc-tooltip-line-crosshair .key { display: flex; gap: 14px; font-size: 12px; color: var(--uk-muted); }
.ukc-tooltip-line-crosshair .key li { display: flex; align-items: center; gap: 6px; }
.ukc-tooltip-line-crosshair .sw { width: 16px; height: 0; border-top: 2px solid var(--uk-accent); }
.ukc-tooltip-line-crosshair .sw.dash { border-top: 2px dashed var(--uk-muted); }
.ukc-tooltip-line-crosshair .area { position: relative; padding-top: 100px; }
.ukc-tooltip-line-crosshair .area svg { position: absolute; left: 0; top: 100px; width: 100%; height: 120px; overflow: visible; }
.ukc-tooltip-line-crosshair .area svg * { vector-effect: non-scaling-stroke; }
.ukc-tooltip-line-crosshair .gl { stroke: var(--uk-line); stroke-width: 1; }
.ukc-tooltip-line-crosshair .la { stroke: var(--uk-accent); stroke-width: 2; stroke-linejoin: round; }
.ukc-tooltip-line-crosshair .lb { stroke: var(--uk-muted); stroke-width: 1.5; stroke-dasharray: 4 4; stroke-linejoin: round; }
.ukc-tooltip-line-crosshair .pts { position: relative; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); }
.ukc-tooltip-line-crosshair .pt { position: relative; }
.ukc-tooltip-line-crosshair .col { width: 100%; display: grid; padding: 0; border: 0; background: none; color: var(--uk-muted); cursor: crosshair; }
.ukc-tooltip-line-crosshair .plot { position: relative; display: block; height: 120px; }
.ukc-tooltip-line-crosshair .rule { position: absolute; left: 50%; top: 0; bottom: 0; border-left: 1px dashed var(--uk-ink); opacity: 0; }
.ukc-tooltip-line-crosshair .dot { position: absolute; left: 50%; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 999px; opacity: 0; }
.ukc-tooltip-line-crosshair .dot.a { top: var(--a); background: var(--uk-accent); box-shadow: 0 0 0 2px var(--uk-paper); }
.ukc-tooltip-line-crosshair .dot.b { top: var(--b); border: 2px solid var(--uk-muted); background: var(--uk-paper); }
.ukc-tooltip-line-crosshair .h { padding-top: 6px; font-family: var(--uk-font-mono, ui-monospace, monospace); font-size: 11px; text-align: center; }
.ukc-tooltip-line-crosshair .pt:hover .rule, .ukc-tooltip-line-crosshair .pt:focus-within .rule, .ukc-tooltip-line-crosshair .pt.show .rule, .ukc-tooltip-line-crosshair .pt:hover .dot, .ukc-tooltip-line-crosshair .pt:focus-within .dot, .ukc-tooltip-line-crosshair .pt.show .dot { opacity: 1; }
.ukc-tooltip-line-crosshair .pt:hover .h, .ukc-tooltip-line-crosshair .pt:focus-within .h, .ukc-tooltip-line-crosshair .pt.show .h { color: var(--uk-ink); font-weight: 700; }
.ukc-tooltip-line-crosshair .pts:has(.pt:hover, .pt:focus-within) .pt.show:not(:hover, :focus-within) :is(.rule, .dot) { opacity: 0; }
.ukc-tooltip-line-crosshair .pts:has(.pt:hover, .pt:focus-within) .pt.show:not(:hover, :focus-within) .h { color: var(--uk-muted); font-weight: 400; }
.ukc-tooltip-line-crosshair .col:focus-visible { outline: 2px solid var(--uk-accent); outline-offset: -2px; }
.ukc-tooltip-line-crosshair .tip { position: absolute; z-index: 2; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); width: max-content; display: grid; gap: 2px; padding: 8px 10px; border-radius: min(var(--uk-radius-md), 8px); background: var(--uk-ink); color: var(--uk-paper); font-size: 12.5px; line-height: 1.35; }
.ukc-tooltip-line-crosshair .pt.lead .tip { left: 0; transform: none; }
.ukc-tooltip-line-crosshair .pt.tail .tip { left: auto; right: 0; transform: none; }
.ukc-tooltip-line-crosshair .hr { font-family: var(--uk-font-mono, ui-monospace, monospace); font-size: 11px; color: color-mix(in srgb, var(--uk-paper) 72%, var(--uk-ink)); }
.ukc-tooltip-line-crosshair .ln { display: grid; grid-template-columns: 16px 1fr auto; align-items: center; gap: 8px; }
.ukc-tooltip-line-crosshair .ln b { font-variant-numeric: tabular-nums; }
.ukc-tooltip-line-crosshair .tip .sw { border-top-color: var(--uk-paper); }
.ukc-tooltip-line-crosshair .dl { margin-top: 3px; padding-top: 4px; border-top: 1px solid color-mix(in srgb, var(--uk-paper) 28%, transparent); font-size: 11.5px; }
.ukc-tooltip-line-crosshair .pt .tip { visibility: hidden; opacity: 0; transition: opacity var(--uk-motion-duration) var(--uk-motion-ease), visibility 0s linear var(--uk-motion-duration); }
.ukc-tooltip-line-crosshair .pt:hover .tip, .ukc-tooltip-line-crosshair .pt:focus-within .tip, .ukc-tooltip-line-crosshair .pt.show .tip { visibility: visible; opacity: 1; transition-delay: 0s; }
.ukc-tooltip-line-crosshair .pts:has(.pt:hover, .pt:focus-within) .pt.show:not(:hover, :focus-within) .tip { visibility: hidden; opacity: 0; }
@media (prefers-reduced-motion: reduce) { .ukc-tooltip-line-crosshair .pt .tip { transition: none; } }
More tooltips and popovers
All 26Marsh Road Velo · Thursday note
Clocks went back, so we roll out at 8:30 sharp. This Sunday is the Old Quarry LoopMmarshroadvelo.ccOld Quarry Loop62 km840 m upCafe at km 38, ridden anticlockwise, with the stop at Hollin Bridge.
Lane rates per mile, week 48 Lane Fuel Rate Reno to Boise $0.42 $2.10 Reno to Fresno $0.42 Ines Cabral Tue 24 NovUp 30 cents. Chain controls on Donner Pass add about two hours each way. Reno to Salt Lake $0.47 Marek Dvorak Mon 23 NovHeld flat. Two carriers still want backhauls out of Utah. Reno to Portland $0.44 $2.30 - 0:00 to 2:14WrenClose by, in the bramble at the gate
- 2:14 to 3:50BlackbirdLoud on the left, top of the alder
- 3:50 to 5:30Reed warblerChattering low in the reeds
- 5:30 to 6:40CuckooFar off, across the water
Dawn chorus, Holme Marsh
Payment terms
The share of each payment the client holds back until the final walkthrough. of 10% is kept from every progress claim on this job and paid out once the client signs off the last inspection.