# CollectionPremiumEmptyState

**Category:** Features/Display/Empty States

## Design

### Description

Displays an empty state encouraging users to upgrade to a premiuim plan. Pass through the `emptyState` prop of a [`Grid`](./?path=/story/base-components-collections-grid-grid--grid), [`Table`](./?path=/story/base-components-collections-table-table--table), or other collection component.


```tsx
import { CollectionPremiumEmptyState } from '@wix/patterns';
```

### Demo

```tsx
import { Avatar, Text } from '@wix/design-system';
import React from 'react';
import { CollectionPage } from '@wix/patterns/page';
import {
  TableGridSwitch,
  useTableGridSwitchCollection,
  Filter,
  idNameArrayFilter,
  stringsArrayFilter,
  CollectionPremiumEmptyState
} from '@wix/patterns';
import { Contact } from '@wix/ambassador-contacts-v4-contact/types';
import { useHttpClient } from '@wix/yoshi-flow-bm';

interface Duration {
  id: string;
  name: string;
  days: number | null;
}

type ContactsFilters = {
  level: Filter<string[]>;
  lastSeen: Filter<Duration[]>;
};

function CollectionPremiumEmptyStateExample() {
  const httpClient = useHttpClient();
  const state = useTableGridSwitchCollection<Contact, ContactsFilters>({
    queryName: 'contacts-EmptyStateNewItemCTA',
    paginationMode: 'offset',
    fetchData: () =>
      Promise.resolve({
        items: [],
        total: 0,
      }),
    itemKey: (item) => item.id as string,
    itemName: (item) => item.name as string,
    fetchErrorMessage: () => 'Error fetching contacts',
    filters: {
      level: stringsArrayFilter(),
      lastSeen: idNameArrayFilter(),
    },
  });

  return (
    <CollectionPage height="500px">
      <CollectionPage.Header title={{ text: 'Contacts' }} />
      <CollectionPage.Content>
        <TableGridSwitch
          state={state}
          columns={[
            {
              title: '',
              width: '50px',
              render: (contact) => (
                <Avatar name={contact.name} imgProps={{ src: contact.image }} />
              ),
            },
            {
              title: 'Name',
              width: '250px',
              render: (contact) => contact.name,
            },
            {
              title: 'Last Seen',
              render: (contact) => contact.lastSeen?.toLocaleString(),
            },
          ]}
          emptyState={
            <CollectionPremiumEmptyState upgradeCta={{ onClick: () => {} }} />
          }
        />
      </CollectionPage.Content>
    </CollectionPage>
  );
}
```

## API

### Props

| Prop | Type | Required | Default | Description |
|------|------|----------|---------|-------------|
| `upgradeCta` | `PremiumButtonProps` | Yes | - | Configures the default call to action button.\ `onClick`: Adds a callback for when the button is clicked. <br> `text`: Text of the button. To render the default upgrade button, you must provide the `onClick` callback. |
| `dataHook` | `string` | No | - | Applies a data-hook HTML attribute to be used in the tests |
| `className` | `string` | No | - | Specifies a CSS class name to be appended to the component’s root element. |
| `children` | `ReactNode` | No | - | Contains components rendered below the subtitle, e.g., `<Button/>` or `<TextButton/>` |
| `title` | `string` | No | - | Overrides the default title. |
| `skin` | `"page" \| "page-no-border" \| "section"` | No | `'section'` | Sets the style skin for the empty state |
| `theme` | `"page" \| "page-no-border" \| "section"` | No | - | @deprecated use skin prop instead |
| `subtitle` | `string` | No | - | Overrides the default subtitle. |
| `image` | `ReactNode` | No | - | Overrides the default image. Accepts a custom `ReactElement` or boolean value. Pass `false` to hide the default image. |
| `classNames` | `{ imageContainer?: string; }` | No | - | Sets the empty state image bottom margin. If not specified, use the default padding defined in the CSS. |
| `align` | `"start" \| "center" \| "end"` | No | `'center'` | Sets the alignment of all empty state contents within the component container |
| `customCta` | `ReactNode` | No | - | Adds another custom call to action button. Pass a [TextButton](https://www.docs.wixdesignsystem.com/?path=/story/components-actions--textbutton) component. |

