diff --git a/packages/react/src/components/DataTableSkeleton/DataTableSkeleton.stories.js b/packages/react/src/components/DataTableSkeleton/DataTableSkeleton.stories.js
index 93020e8ba6bc..239ded4f1fb9 100644
--- a/packages/react/src/components/DataTableSkeleton/DataTableSkeleton.stories.js
+++ b/packages/react/src/components/DataTableSkeleton/DataTableSkeleton.stories.js
@@ -20,7 +20,7 @@ const props = () => ({
});
export default {
- title: 'Components/DataTable',
+ title: 'Components/DataTable/Skeleton',
decorators: [withKnobs],
component: DataTableSkeleton,
};
@@ -34,3 +34,25 @@ export const Skeleton = () => {
);
};
+
+export const Playground = (args) => {
+ return (
+
+
+
+
+ );
+};
+
+Playground.argTypes = {
+ headers: {
+ table: {
+ disable: true,
+ },
+ },
+ className: {
+ table: {
+ disable: true,
+ },
+ },
+};
diff --git a/packages/react/src/components/DataTableSkeleton/DataTableSkeleton.js b/packages/react/src/components/DataTableSkeleton/DataTableSkeleton.tsx
similarity index 76%
rename from packages/react/src/components/DataTableSkeleton/DataTableSkeleton.js
rename to packages/react/src/components/DataTableSkeleton/DataTableSkeleton.tsx
index d0e1668fb566..f7c8e71aca36 100644
--- a/packages/react/src/components/DataTableSkeleton/DataTableSkeleton.js
+++ b/packages/react/src/components/DataTableSkeleton/DataTableSkeleton.tsx
@@ -10,6 +10,49 @@ import React from 'react';
import cx from 'classnames';
import { usePrefix } from '../../internal/usePrefix';
+export interface DataTableSkeletonProps {
+ /**
+ * Specify an optional className to add.
+ */
+ className?: string;
+
+ /**
+ * Specify the number of columns that you want to render in the skeleton state
+ */
+ columnCount: number;
+
+ /**
+ * Optionally specify whether you want the Skeleton to be rendered as a
+ * compact DataTable
+ */
+ compact: boolean;
+
+ /**
+ * Optionally specify the displayed headers
+ */
+ headers?: [{ header: string; key: string }] | { header: string; key: string };
+
+ /**
+ * Specify the number of rows that you want to render in the skeleton state
+ */
+ rowCount: number;
+
+ /**
+ * Specify if the table header should be rendered as part of the skeleton.
+ */
+ showHeader: boolean;
+
+ /**
+ * Specify if the table toolbar should be rendered as part of the skeleton.
+ */
+ showToolbar: boolean;
+
+ /**
+ * Optionally specify whether you want the DataTable to be zebra striped
+ */
+ zebra: boolean;
+}
+
const DataTableSkeleton = ({
headers,
rowCount,
@@ -48,8 +91,8 @@ const DataTableSkeleton = ({
{showHeader ? (
) : null}
{showToolbar ? (
@@ -58,7 +101,8 @@ const DataTableSkeleton = ({
className={`${prefix}--table-toolbar`}>
+ className={`${prefix}--skeleton ${prefix}--btn ${prefix}--btn--sm`}
+ />
) : null}
@@ -72,7 +116,7 @@ const DataTableSkeleton = ({
{headers[i]?.header}
) : (
-
+
)}
))}