بنقرة واحدة
heimdall-data-display
Heimdall component guide for Data Display: StatTile, StatGrid, Table, KVGrid, InspectorPanel
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Heimdall component guide for Data Display: StatTile, StatGrid, Table, KVGrid, InspectorPanel
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Heimdall component guide for Charts: Sparkline, LineChart, BarChart, BarV, BarH, StackedBar, Donut, PieChart, Heatmap, StatusTimeline, ProgressBar, MetricRow
Heimdall component guide for Chat: ChatMessage, ToolBlock, ThinkingBlock, ChatDivider, ChatSuggestions, ChatComposer, ChatContainer
Heimdall component guide for Graph: GraphCanvas, GraphNode, GraphEdge, GraphInspector, TopologyNode, HierarchyRow, HierarchyTree
Heimdall component guide for Inputs: TextInput, TextArea, NumberInput, Select, TriState, Field, FilterDropdown, EntityPicker, KeyValueEditor, OrderedList, RelationshipBuilder
Heimdall component guide for Layout: Panel, SplitPane
Heimdall component guide for Navigation: NavItem, Sidebar, Topbar, TabBar
| name | heimdall-data-display |
| description | Heimdall component guide for Data Display: StatTile, StatGrid, Table, KVGrid, InspectorPanel |
Import all components from @tinkermonkey/heimdall-ui. Import the CSS once at your app entry point:
import '@tinkermonkey/heimdall-ui/css'
KPI metric tile with colored left bar, optional delta trend, sparkline, icon, and meta text.
import { StatTile } from '@tinkermonkey/heimdall-ui'
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | '' | Monospace eyebrow label (e.g. 'UPTIME') |
value | string | number | '' | Primary metric value |
color | 'emerald' | 'amber' | 'rose' | 'cyan' | 'violet' | 'neutral' | 'cyan' | Left bar and sparkline color |
delta | { value: number; label?: string; direction?: 'up' | 'down' } | — | Trend indicator below value |
icon | IconName | — | Icon displayed in tile |
sparkData | number[] | — | Sparkline data points |
meta | ReactNode | — | Secondary text below value |
metaIcon | IconName | — | Icon before meta text |
...HTMLAttributes | Standard div attributes |
// Minimal
<StatTile label="UPTIME" value="99.9%" />
// Full-featured
<StatTile
label="LATENCY"
value="42 ms"
color="violet"
delta={{ value: 3, label: 'vs yesterday', direction: 'down' }}
sparkData={[55, 48, 52, 44, 42, 45, 42]}
meta="Last 30 days"
metaIcon="clock"
/>
aria-label defaults to "${label}: ${value}" if not providedcolor propdirection controls both the sign prefix (+/−) and stylingCSS grid wrapper for laying out multiple StatTile components.
import { StatGrid } from '@tinkermonkey/heimdall-ui'
| Prop | Type | Default | Description |
|---|---|---|---|
columns | number | 4 | Number of grid columns |
children | ReactNode | required | StatTile components |
...HTMLAttributes | Standard div attributes |
<StatGrid>
<StatTile label="CPU" value="42%" color="cyan" />
<StatTile label="MEMORY" value="62%" color="amber" />
<StatTile label="REQUESTS" value="1.2M" color="emerald" />
<StatTile label="ERRORS" value="3" color="rose" />
</StatGrid>
// Two-column layout
<StatGrid columns={2}>
<StatTile label="UPTIME" value="99.9%" />
<StatTile label="INCIDENTS" value="0" />
</StatGrid>
Data table with sorting, row selection, row click, and custom cell rendering.
import { Table } from '@tinkermonkey/heimdall-ui'
| Prop | Type | Default | Description |
|---|---|---|---|
columns | Column<T>[] | required | Column definitions |
data | T[] | required | Row data |
rowKey | keyof T | ((row: T, index: number) => string | number) | required | Unique row identifier |
selectable | boolean | false | Show checkbox column |
selectedRows | (string | number)[] | [] | Controlled selected row keys |
onSelectRows | (rowKeys: (string | number)[]) => void | — | Called on selection change |
onRowClick | (row: T, rowKey: string | number) => void | — | Called on row click |
onSort | (key: string, direction: 'asc' | 'desc' | null) => void | — | Called on header click |
emptyState | ReactNode | — | Content shown when data is empty |
className | string | — | Additional CSS classes |
interface Column<T> {
key: keyof T
label: string
sortable?: boolean
width?: string
render?: (value: T[keyof T], row: T, index: number) => React.ReactNode
}
// Minimal
<Table
columns={[
{ key: 'name', label: 'NAME' },
{ key: 'status', label: 'STATUS' },
]}
data={rows}
rowKey="id"
/>
// Full-featured with sorting, selection, custom render
const columns: Column<Host>[] = [
{
key: 'name',
label: 'HOST',
sortable: true,
render: v => <span className="font-mono">{String(v)}</span>,
},
{
key: 'status',
label: 'STATUS',
render: v => <Chip variant={statusMap[v as string]}>{String(v)}</Chip>,
},
{ key: 'cpu', label: 'CPU', sortable: true },
]
<Table
columns={columns}
data={hosts}
rowKey="id"
selectable
selectedRows={selected}
onSelectRows={setSelected}
onRowClick={(row) => navigate(`/hosts/${row.id}`)}
onSort={(key, dir) => setSortState({ key, dir })}
emptyState={<span>No hosts found.</span>}
/>
onSort is only for external data re-fetching or side effects — sort clicking cycles asc → desc → nullonRowClick is provided, rows become keyboard-focusable (Enter or Space triggers click)render() receives (value, row, index) — use row to access other fields for conditional renderingKey/value metadata grid rendered as a semantic definition list.
import { KVGrid } from '@tinkermonkey/heimdall-ui'
| Prop | Type | Default | Description |
|---|---|---|---|
rows | KVGridRow[] | [] | Array of key/value pairs |
keyWidth | number | string | 130 (via CSS) | Key column width in px or CSS string |
...HTMLAttributes | Standard <dl> attributes |
interface KVGridRow {
key: string
value: React.ReactNode
}
<KVGrid
rows={[
{ key: 'hostname', value: 'nyx-01.internal' },
{ key: 'ip_address', value: '192.168.1.100' },
{ key: 'cpu_cores', value: '16' },
]}
/>
// Custom key column width
<KVGrid rows={rows} keyWidth={200} />
<KVGrid rows={rows} keyWidth="30%" />
<dl>/<dt>/<dd> for semantic HTMLStructured details panel for entity inspection, with optional section and property subcomponents.
import { InspectorPanel } from '@tinkermonkey/heimdall-ui'
| Prop | Type | Default | Description |
|---|---|---|---|
title | string | required | Primary heading |
id | string | required | Entity identifier shown below title |
eyebrow | string | '' | Monospace uppercase label above title |
version | number | — | Version number shown as amber pill |
actions | ReactNode | — | Action buttons in the header |
children | ReactNode | — | InspectorPanel.Section or InspectorPanel.PropertySection |
InspectorPanel.Section — generic section with title and optional count/actionsInspectorPanel.PropertySection — specialized section for tabular key/value rowsInspectorPanel.Section props:
| Prop | Type | Default | Description |
|---|---|---|---|
title | string | required | Section heading |
count | number | — | Count shown after title with · separator |
actions | ReactNode | — | Action buttons in section header |
children | ReactNode | — | Section content |
InspectorPanel.PropertySection props:
| Prop | Type | Default | Description |
|---|---|---|---|
title | string | required | Section heading |
count | number | — | Count shown inline |
actionIcon | ReactNode | — | Icon for action button |
actionLabel | string | — | Accessible label for action button |
onAction | () => void | — | Action button handler; button only renders when provided |
rows | PropertyRow[] | required | Key/value/usage rows |
interface PropertyRow {
key: string
value: string
usageCount?: number
}
// Minimal
<InspectorPanel title="Organism" id="cls_4f3a" eyebrow="CLASS">
<InspectorPanel.Section title="Properties">
<KVGrid rows={[{ key: 'domain', value: 'life' }]} />
</InspectorPanel.Section>
</InspectorPanel>
// Full-featured with PropertySection
<InspectorPanel
eyebrow="SCHEMA"
title="cls_organism"
id="cls_4f3a"
version={2}
actions={<Button variant="ghost" size="sm"><Icon name="edit" size={14} /></Button>}
>
<InspectorPanel.PropertySection
title="Fields"
count={3}
actionIcon={<Icon name="plus" size={12} />}
actionLabel="Add field"
onAction={() => setAddingField(true)}
rows={[
{ key: 'name', value: 'string', usageCount: 47 },
{ key: 'status', value: 'enum', usageCount: 47 },
{ key: 'created_at', value: 'datetime', usageCount: 12 },
]}
/>
<InspectorPanel.Section title="Tags" count={2}>
<div className="flex gap-1">
<Chip form="id-tag">production</Chip>
<Chip form="id-tag">critical</Chip>
</div>
</InspectorPanel.Section>
</InspectorPanel>
InspectorPanel.Section and InspectorPanel.PropertySection must be used inside <InspectorPanel> — they depend on its contextPropertySection only renders when onAction is providedversion renders as an amber VersionPill only when the prop is defined