logo

S2

  • Manual
  • API
  • Examples
  • Playground
  • ChangeLog
  • Productsantv logo arrow
  • 2.x
  • Introduction
  • Quick Start
  • Basic Tutorial
    • Base Concept
    • Sheet Type
      • Pivot Mode
        Updated
      • Table Mode
    • Conditions
      Updated
    • Totals
    • Sort
      • Custom Sort
        Updated
      • Group Sort
        Updated
    • Theme
      Updated
    • Tooltip
      Updated
    • Internationalization
    • 数据格式化
      New
    • Multi Line
      New
    • Pagination
      New
  • Advanced Tutorial
    • Advanced Tutorial
      • Link
      • Render Chart In Cell
      • Draw Chart With @antv/g2
    • Custom
      • Customize Hook
        Updated
      • Customize Tree
        New
      • Customize Icon
      • Customize Cell Alignment
      • Customize Cell Size
        Updated
      • Customize Order
      • Custom Collapse/Expand Nodes
    • Interaction
      • Basic Interaction
      • Custom Interaction
      • Hide Columns
      • Cell Resize
      • Merge Cell
      • Scroll
      • Copy
        New
      • Highlight and select cell
        New
    • Analyze Component
      • Introduction
        New
      • Advanced Sort
        Updated
      • Switcher
      • Export
        Updated
      • Pagination
      • Drill Down
    • Sheet Component
      • Editable Mode
      • Strategy Sheet
        Updated
    • HD Adapter
    • Get Instance
    • Get Cell Data
      Updated
    • Table adaptive
    • AntV/G Plugins
      New
    • Pivot Chart
      Experimental
    • Vue 3.0
  • Extended Reading
    • Data Process
      • Pivot
      • Table
    • Layout
      • Pivot
      • Table
    • Performance
      Updated
  • Contribution
  • FAQ
  • S2 2.0 Migration Guide

Introduction

Next
Quick Start

Resources

Ant Design
Galacea Effects
Umi-React Application Framework
Dumi-Component doc generator
ahooks-React Hooks Library

Community

Ant Financial Experience Tech
seeconfSEE Conf-Experience Tech Conference

Help

GitHub
StackOverflow

more productsMore Productions

Ant DesignAnt Design-Enterprise UI design language
yuqueYuque-Knowledge creation and Sharing tool
EggEgg-Enterprise-class Node development framework
kitchenKitchen-Sketch Tool set
GalaceanGalacean-互动图形解决方案
xtechLiven Experience technology
© Copyright 2025 Ant Group Co., Ltd..备案号:京ICP备15032932号-38

Loading...

Version Version ci test status Coverage release-date

❓ What is S2

S2 is a data-driven table visualization engine for the field of visual analytics. "S" is taken from the two "S" of "SpreadSheet", and "2" represents the two dimensions of row and column in the pivot table. Aims to provide beautiful, easy-to-use, high-performance, and easy-to-extend multidimensional tables.

demos

✨ Features

  1. Out-of-the-box: Provide out-of-the-box React , Vue3 table components and supporting analysis components in different scenarios, and only need simple configuration to easily implement complex scenarios.
  2. Multidimensional cross-analysis: bid farewell to a single analysis dimension, fully embrace the free combination analysis of any dimension.
  3. High performance: It can support <4s rendering with a full amount of millions of data, and can also achieve second-level rendering through partial drill-down.
  4. High scalability: supports arbitrary custom extensions (including but not limited to layout, style, interaction, data flow, etc.).
  5. Friendly interaction: support rich interactive forms (single selection, circle selection, row selection, column selection, frozen row header, width and height drag and drop, custom interaction, etc.)

📦 install

npm install @antv/s2
# yarn add @antv/s2

🔨 use

1. Data preparation

s2DataConfig
 const&nbsp;s2DataConfig&nbsp;=&nbsp;{
&nbsp;&nbsp;fields:&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;rows:&nbsp;['province',&nbsp;'city'],
&nbsp;&nbsp;&nbsp;&nbsp;columns:&nbsp;['type'],
&nbsp;&nbsp;&nbsp;&nbsp;values:&nbsp;['price'],
&nbsp;&nbsp;},
&nbsp;&nbsp;data:&nbsp;[
&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;province:&nbsp;"浙江",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;city:&nbsp;"杭州",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;type:&nbsp;"笔",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;price:&nbsp;"1",
&nbsp;&nbsp;&nbsp;&nbsp;},
&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;province:&nbsp;"浙江",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;city:&nbsp;"杭州",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;type:&nbsp;"纸张",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;price:&nbsp;"2",
&nbsp;&nbsp;&nbsp;&nbsp;},
&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;province:&nbsp;"浙江",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;city:&nbsp;"舟山",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;type:&nbsp;"笔",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;price:&nbsp;"17",
&nbsp;&nbsp;&nbsp;&nbsp;},
&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;province:&nbsp;"浙江",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;city:&nbsp;"舟山",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;type:&nbsp;"纸张",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;price:&nbsp;"6",
&nbsp;&nbsp;&nbsp;&nbsp;},
&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;province:&nbsp;"吉林",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;city:&nbsp;"长春",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;type:&nbsp;"笔",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;price:&nbsp;"8",
&nbsp;&nbsp;&nbsp;&nbsp;},
&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;province:&nbsp;"吉林",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;city:&nbsp;"白山",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;type:&nbsp;"笔",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;price:&nbsp;"12",
&nbsp;&nbsp;&nbsp;&nbsp;},
&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;province:&nbsp;"吉林",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;city:&nbsp;"长春",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;type:&nbsp;"纸张",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;price:&nbsp;"3",
&nbsp;&nbsp;&nbsp;&nbsp;},
&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;province:&nbsp;"吉林",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;city:&nbsp;"白山",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;type:&nbsp;"纸张",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;price:&nbsp;"25",
&nbsp;&nbsp;&nbsp;&nbsp;},
&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;province:&nbsp;"浙江",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;city:&nbsp;"杭州",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;type:&nbsp;"笔",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cost:&nbsp;"0.5",
&nbsp;&nbsp;&nbsp;&nbsp;},
&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;province:&nbsp;"浙江",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;city:&nbsp;"杭州",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;type:&nbsp;"纸张",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cost:&nbsp;"20",
&nbsp;&nbsp;&nbsp;&nbsp;},
&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;province:&nbsp;"浙江",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;city:&nbsp;"舟山",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;type:&nbsp;"笔",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cost:&nbsp;"1.7",
&nbsp;&nbsp;&nbsp;&nbsp;},
&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;province:&nbsp;"浙江",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;city:&nbsp;"舟山",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;type:&nbsp;"纸张",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cost:&nbsp;"0.12",
&nbsp;&nbsp;&nbsp;&nbsp;},
&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;province:&nbsp;"吉林",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;city:&nbsp;"长春",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;type:&nbsp;"笔",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cost:&nbsp;"10",
&nbsp;&nbsp;&nbsp;&nbsp;},
&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;province:&nbsp;"吉林",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;city:&nbsp;"白山",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;type:&nbsp;"笔",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cost:&nbsp;"9",
&nbsp;&nbsp;&nbsp;&nbsp;},
&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;province:&nbsp;"吉林",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;city:&nbsp;"长春",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;type:&nbsp;"纸张",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cost:&nbsp;"3",
&nbsp;&nbsp;&nbsp;&nbsp;},
&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;province:&nbsp;"吉林",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;city:&nbsp;"白山",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;type:&nbsp;"纸张",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cost:&nbsp;"1",
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;]
};

2. Configuration item preparation

const s2Options = {
width: 600,
height: 600
}

3. Rendering

<div id="container" />
import { PivotSheet } from '@antv/s2';
async function run() {
const container = document.getElementById('container');
const s2 = new PivotSheet(container, s2DataConfig, s2Options);
await s2.render(); // return Promise
}
run();

4. Results

preview

📦 version

Note

There are three ways to create an S2 table: the basic version @antv/s2 and the React and Vue3 versions wrapped based on @antv/s2:

  1. Basic version @antv/s2: Developed based on Canvas and AntV/G 6.0, providing basic table display/interaction capabilities.

Dependencies: None

  1. React version @antv/s2-react: Wrapped based on React 18 and @antv/s2, compatible with React 16/17 versions, and provides supporting analysis components (@antv/s2-react-components).

Dependencies:

"peerDependencies": {
"@antv/s2": "^2.0.0",
"react": ">=16.9.0",
"react-dom": ">=16.9.0"
}
  1. Vue version @antv/s2-vue: Wrapped based on Vue3, @antv/s2, and ant-design-vue@3.x. Maintenance Discontinued

Dependencies:

"peerDependencies": {
"@antv/s2": "^2.0.0",
"ant-design-vue": "^3.2.0",
"vue": ">=3.x"
}

In other words, @antv/s2 is framework-agnostic with no additional dependencies. You can use it in any framework like Vue, Angular, etc.

Package NameStable VersionPackage SizeDownloads
@antv/s2latestsizedownload
@antv/s2-reactlatestsizedownload
@antv/s2-react-componentslatestsizedownload
@antv/s2-vue (Discontinued)latestsizedownload

How to get notifications for new version releases?

  • Subscribe to: https://github.com/antvis/S2/releases.atom to receive notifications of new version releases.
  • Watch the S2 repository, select Custom - Releases to receive push notifications.

preview

👤 author

@AntV

🤝 Participate and contribute

Eager to contribute? View contribution guidelines

S2 uses pnpm as package manager

git clone git@github.com:antvis/S2.git
cd S2
# 切换到 2.x 分支
git checkout next
# 安装依赖
pnpm install # 或者 pnpm bootstrap
# 打包
pnpm build
# 调试 s2-core
pnpm core:start
# 调试 s2-react
pnpm react:Playground
# 调试 s2-vue
pnpm vue:Playground
# 单元测试
pnpm test
# 代码风格和类型检测
pnpm lint
# 本地启动官网
pnpm site:start

📧 Contact us

DingTalk

👬 Contributors

https://github.com/antvis/s2/graphs/contributors

📄 License

MIT@ AntV .