From 107a1476b0c42160b2590227d3ac39386dec839f Mon Sep 17 00:00:00 2001 From: Heikki Hellgren Date: Sat, 14 Sep 2024 14:00:43 +0300 Subject: [PATCH] fix: table width overriden with custom styles when custom styles are passed to Table component, they override the default width 100%. moving the style out of restProps fixes this issue while still allows customizing the width if wanted. Signed-off-by: Heikki Hellgren --- .changeset/giant-seas-smile.md | 5 +++++ packages/core-components/src/components/Table/Table.tsx | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changeset/giant-seas-smile.md diff --git a/.changeset/giant-seas-smile.md b/.changeset/giant-seas-smile.md new file mode 100644 index 0000000000..6c5bd899e7 --- /dev/null +++ b/.changeset/giant-seas-smile.md @@ -0,0 +1,5 @@ +--- +'@backstage/core-components': patch +--- + +Fixed Table width being overriden by custom styling diff --git a/packages/core-components/src/components/Table/Table.tsx b/packages/core-components/src/components/Table/Table.tsx index e0bd3541f5..bcd411934b 100644 --- a/packages/core-components/src/components/Table/Table.tsx +++ b/packages/core-components/src/components/Table/Table.tsx @@ -350,6 +350,7 @@ export function Table(props: TableProps) { onStateChange, components, isLoading: loading, + style, ...restProps } = props; const tableClasses = useTableStyles(); @@ -483,7 +484,7 @@ export function Table(props: TableProps) { } data={tableData} - style={{ width: '100%' }} + style={{ width: '100%', ...style }} localization={{ toolbar: { searchPlaceholder: 'Filter', searchTooltip: 'Filter' }, ...localization,