io.display.metadata
Displays a series of label/value pairs in a variety of layout options.
Usage
- TypeScript
- JavaScript
- Python Experimental
await io.display.metadata("User info", {
layout: "card",
data: [
{
label: "Name",
value: `${user.firstName} ${user.lastName}`,
},
{
label: "Email",
value: user.email,
url: `mailto:${user.email}`,
},
{
label: "Friends",
value: user.friends.length,
},
],
});
await io.display.metadata("User info", {
layout: "card",
data: [
{
label: "Name",
value: `${user.firstName} ${user.lastName}`,
},
{
label: "Email",
value: user.email,
url: `mailto:${user.email}`,
},
{
label: "Friends",
value: user.friends.length,
},
],
});
await io.display.metadata("User info",
layout="card",
data=[
{
"label": "Name",
"value": f"{user.first_name} {user.last_name}",
},
{
"label": "Email",
"value": user.email,
"url": f"mailto:{user.email}",
},
{
"label": "Friends",
"value": len(user.friends),
},
],
)
interval.com
Props
- TypeScript
- JavaScript
- Python Experimental
data
Required
object[]
Array of label/value objects, with optional markup data.
{
// the item label
label?: string;
// the item display text value
value?: string | number | boolean | Date;
// links the item to an external URL
url?: string;
// links the item to another action or page
route?: string;
// arbitrary key/value pairs to send to the linked route
props?: Record<string, any>;
// a visible image to be displayed in the cell
// must contain either `url` or `buffer`
image?: {
// a URL to the image
url?: string
// a buffer containing the image contents
buffer?: Buffer
// the image alt tag
alt?: string
// the size of the image
size?: "thumbnail" | "small" | "medium" | "large"
}
}[]
layout
Optional
'card' | 'list' | 'grid'
Layout to display the metadata items, defaults to "grid"
Returns
null
data
Required
object[]
Array of label/value objects, with optional markup data.
{
// the item label
label?: string;
// the item display text value
value?: string | number | boolean | Date;
// links the item to an external URL
url?: string;
// links the item to another action or page
route?: string;
// arbitrary key/value pairs to send to the linked route
props?: Record<string, any>;
// a visible image to be displayed in the cell
// must contain either `url` or `buffer`
image?: {
// a URL to the image
url?: string
// a buffer containing the image contents
buffer?: Buffer
// the image alt tag
alt?: string
// the size of the image
size?: "thumbnail" | "small" | "medium" | "large"
}
}[]
layout
Optional
'card' | 'list' | 'grid'
Layout to display the metadata items, defaults to "grid"
Returns
null
data
Required
KeyValueObject
List of label/value objects, with optional markup data.
PrimitiveValue = str | int | float | bool | date | time | datetime
KeyValueObject = PrimitiveValue | list["KeyValueObject"] | dict[str, "KeyValueObject"]
layout
Optional
Literal["card", "list", "grid"]
Layout to display the metadata items, defaults to "grid"
Returns
None
Did this section clearly explain what you wanted to learn?