DataCard
@experimental
Structured metadata card for models, datasets, experiments, and entities.
Quick Start
from faststrap import DataCard
DataCard(
"ResNet-50",
subtitle="Image Classification",
status="active",
metrics={"Accuracy": "95.2%", "Loss": "0.04"},
fields={"Framework": "PyTorch", "Version": "v2.1"},
)
Features
- Title, subtitle, and status badge
- Metrics section for key-value pairs
- Metadata table for detailed fields
- Optional footer for actions
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
title |
str |
required | Primary title or entity name. |
subtitle |
str \| None |
None |
Optional secondary description. |
status |
str \| None |
None |
Status string rendered as a badge. |
metrics |
dict[str, str] \| None |
None |
Metric name → value pairs. |
fields |
dict[str, str] \| None |
None |
Field name → value pairs rendered as a table. |
footer |
Any \| None |
None |
Optional footer content. |
variant |
str |
"default" |
Visual variant. |
**kwargs |
Any |
Extra wrapper attributes. |
Usage Examples
Model Card
DataCard(
"GPT-4o",
subtitle="OpenAI Multimodal",
status="active",
metrics={"Parameters": "1.8T", "Context": "128K"},
fields={"Provider": "OpenAI", "Type": "LLM", "License": "Proprietary"},
)
Dataset Card
DataCard(
"CIFAR-10",
subtitle="Image Classification",
status="completed",
metrics={"Samples": "60K", "Classes": "10", "Size": "163 MB"},
fields={"Format": "Pickle", "Split": "50K/10K"},
)
Experiment Run
DataCard(
"Run #42",
subtitle="2024-01-15",
status="failed",
metrics={"Duration": "2h 34m", "Epochs": "50"},
fields={"Learning Rate": "0.001", "Batch Size": "32"},
footer=Button("Retry", variant="outline-primary"),
)
Notes
- Status strings are mapped to Bootstrap badge variants automatically.
- Marked
@experimental.
API Reference
faststrap.components.display.data_card.DataCard(title, *, subtitle=None, status=None, metrics=None, fields=None, footer=None, variant='default', **kwargs)
Structured metadata card for models, datasets, experiments, and entities.
Provides a consistent surface for displaying key-value metadata, status badges, and summary metrics.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str
|
Primary title or entity name. |
required |
subtitle
|
str | None
|
Optional secondary description. |
None
|
status
|
str | None
|
Optional status string rendered as a badge. |
None
|
metrics
|
dict[str, str] | None
|
Optional dict of metric name -> value pairs. |
None
|
fields
|
dict[str, str] | None
|
Optional dict of field name -> value pairs rendered as a metadata table. |
None
|
footer
|
Any | None
|
Optional footer content. |
None
|
variant
|
str
|
Visual variant. Currently only |
'default'
|
**kwargs
|
Any
|
Additional HTML attributes for the wrapper. |
{}
|
Returns:
| Type | Description |
|---|---|
Div
|
FastHTML |