Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions src/components/Table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,11 @@ interface CommonTableProps
size?: TableSize;
showHeader?: boolean;
rowHeight?: string;
/**
* Apply `table-layout: fixed`, making table follow assigned dimensions strictly,
* at the expense of cutting off content that doesn't fit
*/
fixedLayout?: boolean;
}

type SelectReturnValue = {
Expand Down Expand Up @@ -576,6 +581,7 @@ const Table = forwardRef<HTMLTableElement, TableProps>(
size = "sm",
showHeader = true,
rowHeight,
fixedLayout = false,
...props
},
ref
Expand Down Expand Up @@ -629,6 +635,7 @@ const Table = forwardRef<HTMLTableElement, TableProps>(
<TableWrapper>
<StyledTable
ref={ref}
$fixed={fixedLayout}
{...props}
>
{showHeader && (
Expand Down Expand Up @@ -765,11 +772,15 @@ const SelectAllCheckbox: FC<SelectAllCheckboxProps> = ({
);
};

const StyledTable = styled.table`
interface StyledTableProps {
$fixed: boolean;
}

const StyledTable = styled.table<StyledTableProps>`
width: 100%;
border-collapse: collapse;
overflow: hidden;
table-layout: fixed;
${({ $fixed }) => $fixed && "table-layout: fixed;"}

@media (max-width: 768px) {
border: none;
Expand Down