Lines from a log or a source's top list, as a plain table that keeps raw values readable on a phone.
<div id="lv-lines" data-mount="lines"></div>
Installation
// package.json: "capsomer": "github:DrDustinEdwards/capsomer#v0.152.2"
import "capsomer/tokens.css";
import "capsomer/base.css";
import "capsomer/log-view.css";import "capsomer/tokens.css";
import "capsomer/log-view.css";
import { LogView } from "capsomer/react/log-view";Usage
import { LogView } from "capsomer/react/log-view";
<LogView
caption="Server errors, last 7 days"
columns={[
{ key: "path", label: "Path", mono: true, cell: (f) => f.path },
{ key: "status", label: "Status", num: true, cell: (f) => f.status },
{ key: "hits", label: "Hits", num: true, cell: (f) => fmt(f.hits) },
]}
rows={e.failures}
rowKey={(f) => `${f.path} ${f.status}`}
truncated={e.truncated}
note={e.note}
empty="No request failed with a 5xx."
/>Examples
No lines
<div id="lv-none" data-mount="none"></div>
API reference
LogView
| Prop | Type | Required | Does |
|---|---|---|---|
caption | string | Yes | What the lines are, for the table's name: "Server errors, last 7 days". |
showCaption | boolean | Show the caption to the eye too; by default it names the table for a screen reader only, since the panel around it has the heading. | |
columns | LogColumn<Row>[] | Yes | |
rows | Row[] | Yes | |
rowKey | (row: Row) => string | Yes | |
truncated | boolean | The source sent only its top lines: say so under them. | |
truncatedNote | ReactNode | ||
note | ReactNode | A note from the source above the lines ("Sampled at 10%"). | |
emptyLabel | string | No lines: a status and what that means ("No request failed with a 5xx"). | |
empty | ReactNode | Yes |
Parts and data attributes
| Class | Is |
|---|---|
.cap-log | the root |
.cap-log-empty | a part |
.cap-log-mono | a part |
.cap-log-note | a part |
Accessibility
A real table with column headers; the scroll box is a named region with tabindex="0".