Socket
Socket
Sign inDemoInstall

jattac.libs.web.responsive-table

Package Overview
Dependencies
43
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    jattac.libs.web.responsive-table

ResponsiveTable is a reusable React component that displays tabular data in a responsive layout.


Version published
Weekly downloads
17
Maintainers
1
Install size
4.26 MB
Created
Weekly downloads
 

Readme

Source

ResponsiveTable

ResponsiveTable is a reusable React component that displays tabular data in a responsive layout.

Features

  • Handles mobile and desktop layouts
  • Customizable columns
  • Dynamic column definitions
  • Card-style mobile view
  • Generic types for flexible data

Usage

<ResponsiveTable columnDefinitions={columns} data={data} />
  • 'columnDefinitions' defines an array of columns, which can be a simple configuration object or dynamic function
  • 'data' is an array of data objects to display in rows

The component handles switching layout based on screen width to optimize for desktop and mobile.

Custom Columns

Columns can be configured using the 'IResponsiveTableColumnDefinition' interface.

Some key configuration options:

  • 'displayLabel': Header label
  • 'dataKey': Maps column to data property
  • 'cellRenderer': Renders cell value

See docs for more details on customization.

Dynamic Columns

Column definitions can also be a function allowing dynamic configurations per row.

Props

Prop definitions provide detailed specification of component contract.

IProps

interface IProps<TData> {
  /** Column definitions */
  columnDefinitions: ColumnDefinition<TData>[];

  /** Table data rows */
  data: TData[];

  /** Optional styling */
  className?: string;

  /** row click handler */
  onRowClicked?: (row: TData) => void;

  /** not data component */
  noDataComponent?: ReactNode;
}
type ColumnDefinition<TData> =
  | IResponsiveTableColumnDefinition<TData>
  | ((rowData: TData, rowIndex?: number) => IResponsiveTableColumnDefinition<TData>);
interface IResponsiveTableColumnDefinition<TData> {
  displayLabel: string | ReactNode;

  dataKey?: keyof TData;

  cellRenderer: (rowData: TData) => ReactNode;
}

Keywords

FAQs

Last updated on 07 Feb 2024

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc