A React Hook that enables resizable column headers for antd and ProTable components.
use-antd-resizable-header is a React Hook that adds column resizing functionality to antd Table and ProTable components. It solves the problem of fixed column widths in antd tables by allowing users to dynamically adjust column sizes through drag interactions on headers. The hook provides type-safe integration and maintains compatibility with existing antd table features.
Frontend developers building data-intensive applications with antd or ProTable components who need enhanced table customization. Particularly useful for teams working on admin dashboards, data management interfaces, or any application requiring flexible table layouts.
Developers choose this over manual implementations because it provides a production-ready, type-safe solution with zero configuration for basic use cases. Its seamless integration with existing antd ecosystems and support for both Table and ProTable components saves development time while maintaining full compatibility with antd's feature set.
antd table 表格头列拖拽 hook / React Hook makes antd Table Header resizable.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Works directly with both antd Table and ProTable components, as shown in the example code, requiring only minimal changes to existing tables for drop-in functionality.
Includes built-in options to save column widths to localStorage via columnsState, enhancing user experience by remembering preferences across sessions.
Allows setting minimum, maximum, and default widths per column with minConstraints and maxConstraints properties, providing granular control over resizing behavior.
Offers onResizeStart and onResizeEnd callbacks, enabling developers to add custom logic during drag interactions, such as analytics or validation.
Requires the use of useMemo or similar techniques to prevent infinite re-renders, as explicitly warned in the README, adding cognitive overhead and potential setup errors.
Mandates that at least one column has no width set to remain adaptable, which can limit design flexibility and require careful planning in complex table layouts.
Fixed columns in ProTable can cause width conflicts, necessitating manual workarounds like adjusting widths or avoiding fixed columns, as noted in the README's special handling section.