百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
F

flat-ui

> 编程语言
开源

平面 UI 欢迎各位朋友! flat-ui 是一个 React 组件,它会将您的平面数据集(对象数组)渲染为表格视图: 它会 ... ...

379 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

平面 UI 欢迎各位朋友! flat-ui 是一个 React 组件,它会将您的平面数据集(对象数组)渲染为表格视图: 它会 ... ...

flat-ui

Welcome friends! flat-ui is a React component that will render your flat dataset (an array of objects) in a table view:

It will...

  • auto-detect types
  • show a distribution of each quantitative column
  • calculate a diff between the main dataset and a diffData dataset
  • give more information about a hovered row & column
  • allow the user to...
    • filter each column
    • sort by any column
    • sticky any column to the left
    • download the filtered & sorted data (csv or json)
    • cycle through the diffs, scrolling to each changed row

Usage

Install using npm or yarn:

bash
yarn add @githubocto/flat-ui

Basic usage:

javascript
import { Grid } from '@githubocto/flat-ui';

const MyComponent = () => {
  const data = [{ column1: 123 }, { column1: 234 }];

  return ;
};

Props

data

array

Your dataset, formatted as an array of objects, where each object is a row in the table.

Optional props

diffData

array

A modified version of your main dataset, formatted as an array of objects, where each object is a row in the table. The table will show "differences" between this dataset and the main dataset:

  • added lines
  • removed lines
  • modified cells

metadata

object

column names as keys and descriptions as values.

canDownload

boolean

Whether or not the table provides "download csv" and "download json" buttons.

downloadFilename

string

The name of the downloaded CSV or JSON file (without extension).

defaultFilters

object

column names as keys, with filter values as values:

  • string for text columns
  • array of numbers for quantitative columns (numbers or dates)

The user can interact with the table and update the filters, but the table will use the default filters when defaultFilters or data changes.

defaultSort

array

The name of the column and the order you want the table to initialize sorting by (e.g. ["Location", "desc"]). The user can interact with the table and update the sort, but the table will use the default sort when defaultSort or data changes.

defaultStickyColumnName

string

The name of the column you want the table to initialize stickied to the left. The user can interact with the table and update the sticky column, but the table will use the default sticky column when defaultStickyColumnName or data changes.

onChange

function

A callback function whose first parameter is the grid state:

javascript
{
  stickyColumnName: "",
  columnNames: ["", ""],
  filteredData: [{}, {}],
  diffs: [{}, {}], // where __status__ is "new"|"old"|"modified"
  filters: {},
  sort: ["column name", "asc" or "desc"],
  schema: {}, // column names : array|short-array|category|number|date
}

isEditable

boolean

Whether or not to allow the user to edit the table.

onEdit

(newData: any[]) => void

A callback when the user edits the data with the updated dataset. This is intended to be used as a controlled component, where the parent component handles data changes.

Developing locally

To get the example up & running:

bash
yarn
yarn start

and also start the example server:

bash
cd example
yarn
yarn start

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

TypeScriptflat-data

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言