Skip to main content

SoftEdgeTable

SoftEdgeTable is a powerful, flexible table component designed for enterprise-grade data presentation and interaction. It supports sorting, filtering, grouping, pagination, and custom layouts. It works out of the box with minimal configuration.


โœจ Featuresโ€‹

  • ๐Ÿ“Š Paginated and scrollable data table
  • ๐ŸŽฏ Column-based filtering (single or multi)
  • ๐Ÿง  Grouping by specific fields
  • ๐ŸŽ› Custom row actions
  • ๐Ÿ’ก Custom views (grid or column/card layout)
  • ๐Ÿ” Integrated with URLSearchParams for filter/pagination state

๐Ÿ“ฆ Importโ€‹

import { SoftEdgeTable } from "softedge-ui";

๐Ÿ“‹ Example Dataโ€‹

const exampleData = [
{
"id": 1,
"name": "Stephen Carter",
"email": "emma19@santiago.com",
"phone": "743-852-2822x59420",
"department": "Sales",
"job_title": "Sales Executive",
"hire_date": "2015-08-14",
"salary": 102533.89
},
{
"id": 2,
"name": "Christopher Martin",
"email": "staciemccarty@henry.biz",
"phone": "1615981245",
"department": "Human Resources",
"job_title": "HR Assistant",
"hire_date": "2023-08-24",
"salary": 108000.54
},
{
"id": 3,
"name": "Diana Wagner",
"email": "joanna72@hotmail.com",
"phone": "(936)225-8264",
"department": "Sales",
"job_title": "Sales Associate",
"hire_date": "2018-09-05",
"salary": 39261.22
},
]
<SoftEdgeTable
data={data}
columns={columns}
filterKeys={{ category: { multipleSelection: true } }}
groupByKey={[{ key: 'category', label: 'Category' }]}
pageSize={15}
height="h-[calc(100vh-200px)]"
backgroundColor="bg-slate-50"
highlightColor="group-hover:bg-white"
searchParams={searchParams}
setSearchParams={setSearchParams}
renderRowActions={(row) => <div>Edit</div>}
addNewButton={() => console.log('Add new')}
addNewButtonTitle="New Record"
view="grid"
renderColumnView={(data) => <CardView data={data} />}
/>

๐Ÿ”ง Props Overviewโ€‹

PropTypeRequiredDescription
dataany[]โŒArray of data objects to display in the table.
columnsColumn[]โœ…Array defining each column. Includes keys such as label, key, width, default, and optional render for custom cell rendering.
service() => Promise<any[]>โœ… (or data)Async function to fetch data for the table. Used when you want to fetch data dynamically instead of passing it directly.
filterKeysRecord<string, FilterConfig>โŒObject that defines filter behavior per field. Use multipleSelection: true to allow multi-select filtering.
groupByKeyGroupBy[]โŒAllows grouping the table by a specific key. Each item should have key and label.
pageSizenumberโŒNumber of rows per page. Helps with pagination.
heightstringโŒTailwind-compatible height class for the scrollable table area. Example: h-[calc(100vh-200px)].
backgroundColorstringโŒTailwind background utility class for the table body.
highlightColorstringโŒTailwind class for hover effect on rows.
searchParamsURLSearchParamsโŒFrom useSearchParams in react-router-dom (Remix/Next). Keeps pagination & filter state in the URL.
setSearchParams(params: URLSearchParams) => voidโŒFunction to update the URL search parameters, paired with searchParams.
renderRowActions(row: any) => React.ReactNodeโŒCustom action buttons or UI rendered at the end of each row. Can return JSX.
view'grid' | 'column'โŒDefines table layout style. Use 'grid' for table view or 'column' for card-based layout.
renderColumnView(data: any[]) => React.ReactNodeโŒCustom renderer function for card/column layout view. Required if view='column'.

๐Ÿงพ Props Example Explanationโ€‹

columnsโ€‹

Defines how each column looks and behaves. Example:

[
{ key: 'id', label: 'ID', width: '50px' },
{ key: 'name', label: 'Full Name', width: '250px', default: true },
{ key: 'salary', label: 'Salary', width: '150px', render: (row) => <p>{...}</p> },
]
  • key: property name in the data object
  • label: column header text
  • width: optional width
  • default: (optional) determines if the column is shown by default
  • render: custom function to render a cell

filterKeysโ€‹

Use this to enable dropdown filters for specific columns.

filterKeys={{
department: { multipleSelection: true },
job_title: { multipleSelection: true },
hire_date: { multipleSelection: false },
}}

groupByKeyโ€‹

Define keys that users can group the data by.

groupByKey={[
{ key: 'department', label: 'Department' },
]}

renderRowActionsโ€‹

You can render anything (buttons, dropdowns, text) in this callback:

renderRowActions={(row) => (
<>
<div className="text-sm text-gray-500">Action 1</div>
<div className="text-sm text-gray-500">Action 2</div>
</>
)}

renderColumnViewโ€‹

This prop allows rendering a custom UI when using view="column" mode:

<SoftEdgeTable
view="column"
renderColumnView={(data) => (
<div className="flex flex-col gap-4 p-4">
{data.map((item) => (
<div key={item.id} className="border p-4 rounded shadow">
<h2 className="text-lg font-bold">{item.name}</h2>
<p className="text-sm text-gray-600">{item.description}</p>
</div>
))}
</div>
)}
/>