
Product
Introducing Pull Request Stories to Help Security Teams Track Supply Chain Risks
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.
@deepbag/react-grid-x
Advanced tools
ReactGridX is a customizable and flexible React table component that supports pagination, dynamic rendering of table data, and customizable column rendering. It provides an easy-to-use interface for displaying tabular data with configurable columns, pagin
@deepbag/react-grid-x
is a customizable and flexible React table component that supports pagination, sorting (client-side and server-side), dynamic rendering of table data, and customizable column rendering. It provides an easy-to-use interface for displaying tabular data with configurable columns, pagination, sorting, and styling.
Check out the live demo of @deepbag/react-grid-x
here.
rgx-table-pagination
or rgx-arrow-pagination
) with configurable rows per page and pagination controls.expandedComponent
to show additional details or content within the same row.loaderComponent
prop. If not provided, the default loader will be used.To install the library, you can use either npm or yarn:
yarn add @deepbag/react-grid-x
npm install @deepbag/react-grid-x
Here's a basic example of how to use the ReactGridX
component in your React project:
import React from "react";
import { ReactGridX } from "@deepbag/react-grid-x";
import "@deepbag/react-grid-x/dist/themes/rgx-theme/rgx-theme-combined.css";
const App = () => {
return (
<div>
<h1>React Grid Example</h1>
<ReactGridX
columns={[
{ name: "Name", key: "name", sortable: true },
{
name: "Age",
key: "age",
sortable: true,
render: (data) => <span>{data.age}</span>,
},
]}
data={[
{ id: 1, name: "John", age: 28 },
{ id: 2, name: "Jane", age: 34 },
]}
rowsPerPageOptions={[5, 10, 15]}
paginationStyle={{
"rgx-table-pagination": { backgroundColor: "#f5f5f5" },
}}
tableStyle={{
"rgx-table": { width: "100%", borderCollapse: "collapse" },
}}
loaderStyle={{
"rgx-loader-container": {},
}}
popupStyle={{ "rgx-popover-content": {} }}
tooltipStyle={{ "rgx-tooltip-container": {} }}
/>
</div>
);
};
export default App;
Prop | Type | Description |
---|---|---|
columns | ReactGridXColumnProps[] | An array of column definitions, each containing a name and optional render function for custom rendering. |
data | any[] | The data to be displayed in the table. Each object should correspond to a row. |
theme | string | The theme for the table (default is "rgx-theme" ). |
rowsPerPageOptions | number[] | Options for rows per page (default is [5, 10, 15] ). |
paginationType | "rgx-table-pagination" | "rgx-arrow-pagination" | The pagination type to use. Options are "rgx-table-pagination" or "rgx-arrow-pagination" . |
paginationStyle | Record<string, React.CSSProperties> | Custom styles for pagination components. |
tableStyle | Record<string, React.CSSProperties> | Custom styles for the table and its elements. |
loaderStyle | Record<string, React.CSSProperties> | Custom styles for the loader component and its elements. |
popupStyle | Record<string, React.CSSProperties> | Custom styles for the popop component and its elements. |
tooltipStyle | Record<string, React.CSSProperties> | Custom styles for the tooltip component and its elements. |
serverSidePagination | boolean | Flag to indicate if server-side pagination should be used (default is false ). |
onPaginationAndRowSizeChange | (page: number, rowsPerPage: number) => void | Callback function for pagination and row size changes. |
totalRows | number | The total number of rows in the database (required for server-side pagination). |
sortable | boolean | Enables sorting on a column (default is false ). |
serverSideSorting | boolean | Enables server-side sorting (default is false ). |
onSorting | (column:{key: string, direction: "asc" "desc"}[]) => void | Callback function to handle server-side sorting logic. |
onRowClick | (rowData: any) => void | Callback function triggered when a row is clicked, receiving the clicked row's data. |
expandedComponent | (rowData: any) => JSX.Element | A function that returns a component to render when a row is expanded, receiving the clicked row's data. |
loading | boolean | A boolean value indicating whether the table is in a loading state. When set to true , the table will show a loader. |
loaderComponent | ({style}:{style?:{}}) => JSX.Element | A function returning a custom loader when the table is loading. The style prop is optional for custom styling. |
selectionCheckbox | boolean | A boolean value that determines whether the table rows will have a checkbox for selection. If set to true , checkboxes will be shown for selecting rows. |
onSelectionCheck | (selectedRows: any[], isAllChecked: boolean) => void | A callback triggered when the selection state changes, receiving an array of selected rows and a boolean indicating if all rows are selected |
mode | 'light' or 'dark' | Defines the table's theme mode. Supports both light and dark modes for better visual adaptability. Default is 'light' . |
ReactGridXColumnProps
)The ReactGridXColumnProps
interface defines the properties that can be set for each column in the ReactGridX
component.
Prop | Type | Description |
---|---|---|
name | string | The column name displayed in the table header. |
key | string | The unique key that matches the data field for this column. |
render | (data: any) => JSX.Element | string | Optional function to customize how cell data is rendered. |
sortable | boolean | Determines whether sorting is enabled for this column. |
onSort | (a: any, b: any, direction: "asc" | "desc") => number | Optional custom sorting function. If provided, it overrides default sorting. |
tooltip | boolean | Enables tooltips for this column when set to true . |
tooltipCustomContent | (data: any) => string | Defines custom tooltip content for the column header. |
The package exports the following components and props interfaces:
ReactGridX
: The main table component.RGXTablePagination
: Pagination component with table-based navigation.RGXArrowPagination
: Pagination component with arrow-based navigation.RGXTooltip
: The default tooltip component displayed for columns.RGXLoader
: The default loader component displayed when the table is in a loading state, which can be customized using the loaderComponent
prop.RGXPopover
: The default popover component displayed for sorting and clearing sorting icons in the header.RGXSVGIcon
: The default component for rendering SVG icons used in the table, ensuring consistent styling and performance.ReactGridXProps
: Props for the ReactGridX
component.RGXTablePaginationProps
: Props for the RGXTablePagination
component.RGXArrowPaginationProps
: Props for the RGXArrowPagination
component.ReactGridXColumnProps
: Column props for defining columns in the ReactGridX
component.RGXTooltipProps
: Props for the RGXTooltip
component.RGXLoaderProps
: Props for the RGXLoader
component.RGXPopoverProps
: Props for the RGXPopover
component.SvgIconProps
: Props for the RGXSVGIcon
component, used for rendering SVG icons consistently.MIT License - see the LICENSE file for details.
FAQs
ReactGridX is a customizable and flexible React table component that supports pagination, dynamic rendering of table data, and customizable column rendering. It provides an easy-to-use interface for displaying tabular data with configurable columns, pagin
We found that @deepbag/react-grid-x demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.
Research
/Security News
npm author Qix’s account was compromised, with malicious versions of popular packages like chalk-template, color-convert, and strip-ansi published.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.