docs/developer_docs/components/design-system/metadatabar.mdx
import { StoryWithControls } from '../../../src/components/StorybookWrapper';
MetadataBar displays a row of metadata items (SQL info, owners, last modified, tags, dashboards, etc.) that collapse responsively based on available width.
<StoryWithControls component="MetadataBar" props={{ title: "Added to 3 dashboards", createdBy: "Jane Smith", modifiedBy: "Jane Smith", description: "To preview the list of dashboards go to More settings.", items: [ { type: "sql", title: "Click to view query" }, { type: "owner", createdBy: "Jane Smith", owners: [ "John Doe", "Mary Wilson" ], createdOn: "a week ago" }, { type: "lastModified", value: "a week ago", modifiedBy: "Jane Smith" }, { type: "tags", values: [ "management", "research", "poc" ] }, { type: "dashboards", title: "Added to 3 dashboards", description: "To preview the list of dashboards go to More settings." } ] }} controls={[ { name: "title", label: "Title", type: "text" }, { name: "createdBy", label: "Created By", type: "text" }, { name: "modifiedBy", label: "Modified By", type: "text" }, { name: "description", label: "Description", type: "text" } ]} />
Edit the code below to experiment with the component:
function Demo() {
const items = [
{ type: 'sql', title: 'Click to view query' },
{
type: 'owner',
createdBy: 'Jane Smith',
owners: ['John Doe', 'Mary Wilson'],
createdOn: 'a week ago',
},
{
type: 'lastModified',
value: 'a week ago',
modifiedBy: 'Jane Smith',
},
{ type: 'tags', values: ['management', 'research', 'poc'] },
];
return <MetadataBar items={items} />;
}
function MinimalMetadata() {
const items = [
{ type: 'owner', createdBy: 'Admin', owners: ['Admin'], createdOn: 'yesterday' },
{ type: 'lastModified', value: '2 hours ago', modifiedBy: 'Admin' },
];
return <MetadataBar items={items} />;
}
function FullMetadata() {
const items = [
{ type: 'sql', title: 'SELECT * FROM ...' },
{ type: 'owner', createdBy: 'Jane Smith', owners: ['Jane Smith', 'John Doe', 'Bob Wilson'], createdOn: '2 weeks ago' },
{ type: 'lastModified', value: '3 days ago', modifiedBy: 'John Doe' },
{ type: 'tags', values: ['production', 'finance', 'quarterly'] },
{ type: 'dashboards', title: 'Used in 12 dashboards' },
{ type: 'description', value: 'This chart shows quarterly revenue breakdown by region and product line.' },
{ type: 'rows', title: '1.2M rows' },
{ type: 'table', title: 'public.revenue_data' },
];
return <MetadataBar items={items} />;
}
| Prop | Type | Default | Description |
|---|---|---|---|
title | string | "Added to 3 dashboards" | - |
createdBy | string | "Jane Smith" | - |
modifiedBy | string | "Jane Smith" | - |
description | string | "To preview the list of dashboards go to More settings." | - |
items | any | [{"type":"sql","title":"Click to view query"},{"type":"owner","createdBy":"Jane Smith","owners":["John Doe","Mary Wilson"],"createdOn":"a week ago"},{"type":"lastModified","value":"a week ago","modifiedBy":"Jane Smith"},{"type":"tags","values":["management","research","poc"]},{"type":"dashboards","title":"Added to 3 dashboards","description":"To preview the list of dashboards go to More settings."}] | - |
import MetadataBar from '@superset/components';
:::tip[Improve this page] This documentation is auto-generated from the component's Storybook story. Help improve it by editing the story file. :::