Skip to content
Draft
Prev Previous commit
Next Next commit
fix empty content
  • Loading branch information
mcasimir committed May 14, 2025
commit 32a523446f58ad97e13608dffdb3e08255fd3107
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,20 @@ import { ServerIcon } from './icons/server-icon';
'NoSavedItemsIcon',
],
mapping: {
DocumentIcon: () => <DocumentIcon />,
ServerIcon: () => <ServerIcon />,
FavoriteIcon: () => <FavoriteIcon isFavorite={false} />,
NoSavedItemsIcon: () => <NoSavedItemsIcon />,
DocumentIcon: DocumentIcon,
ServerIcon: ServerIcon,
FavoriteIcon: FavoriteIcon,
NoSavedItemsIcon: NoSavedItemsIcon,
},
description: 'Icon to display in the empty state',
description:
'Icon component to display in the empty state (pass the component, not an element)',
},
}}
/>

# EmptyContent

The EmptyContent component is used to display an empty state with an optional icon, title, subtitle, and call to action.
The EmptyContent component is used to display an empty state with an optional icon, title, subtitle, and call to action. The `icon` prop expects a React component (e.g. `DocumentIcon`), not a JSX element (e.g. `<DocumentIcon />`).

## Usage

Expand All @@ -44,13 +45,13 @@ The EmptyContent component is used to display an empty state with an optional ic
<EmptyContent
title="No Documents"
subTitle="There are no documents in this collection."
icon={<DocumentIcon />}
icon={DocumentIcon}
/>

<EmptyContent
title="No Saved Queries"
subTitle="You haven't saved any queries yet."
icon={<FavoriteIcon isFavorite={false} />}
icon={FavoriteIcon}
callToAction="Click here to create your first query"
/>
```
Expand All @@ -77,7 +78,7 @@ Default empty state with title and subtitle.
<EmptyContent
title="No Documents"
subTitle="There are no documents in this collection."
icon={<DocumentIcon />}
icon={DocumentIcon}
/>
)}
</Story>
Expand All @@ -91,7 +92,7 @@ Empty state with a document icon.
<EmptyContent
title="No Saved Queries"
subTitle="You haven't saved any queries yet."
icon={<FavoriteIcon isFavorite={false} />}
icon={FavoriteIcon}
callToAction="Click here to create your first query"
/>
)}
Expand Down