Empty

Empty state placeholder.

When To Use#

  • When there is no data provided, display for friendly tips.

  • User tutorial to create something in fresh new situation.

Examples

No Data

Simplest Usage.

expand codeexpand code
import { Empty } from 'infrad';

const App: React.FC = () => <Empty />;

export default App;
No Application Found

You can choose another style of type by setting image to NO_APP.

expand codeexpand code
import { Empty } from 'infrad';

ReactDOM.render(<Empty type="NO_APP" />, mountNode);
No Data

You can choose another style of image by setting image to Empty.PRESENTED_IMAGE_SIMPLE.

expand codeexpand code
import { Empty } from 'infrad';

const App: React.FC = () => <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />;

export default App;
No Data

You can choose another style of type by setting image to NO_DATA.

expand codeexpand code
import { Empty } from 'infrad';

ReactDOM.render(<Empty type="NO_DATA" />, mountNode);
No Logs Found

You can choose another style of type by setting image to NO_LOG.

expand codeexpand code
import { Empty } from 'infrad';

ReactDOM.render(<Empty type="NO_LOG" />, mountNode);
No Operation Records

You can choose another style of type by setting image to NO_RECORDS.

expand codeexpand code
import { Empty } from 'infrad';

ReactDOM.render(<Empty type="NO_RECORDS" />, mountNode);
Your search does not match any results

You can choose another style of type by setting image to NO_RESULTS.

expand codeexpand code
import { Empty } from 'infrad';

ReactDOM.render(<Empty type="NO_RESULTS" />, mountNode);
You hava not received any ratings

You can choose another style of type by setting image to NO_RATINGS.

expand codeexpand code
import { Empty } from 'infrad';

ReactDOM.render(<Empty type="NO_RATINGS" />, mountNode);
No Image Found

You can choose another style of type by setting image to NO_IMAGE.

expand codeexpand code
import { Empty } from 'infrad';

ReactDOM.render(<Empty type="NO_IMAGE" />, mountNode);
No Premission

You can choose another style of type by setting image to NO_PREMISSION.

expand codeexpand code
import { Empty } from 'infrad';

ReactDOM.render(<Empty type="NO_PREMISSION" />, mountNode);

Select

TreeSelect

Cascader

Transfer

0 item
No Data
0 item
No Data

Table

NameAge
No Data

List

No Data

Use ConfigProvider set global Empty style.

expand codeexpand code
import { SmileOutlined } from 'infra-design-icons';
import {
  Cascader,
  ConfigProvider,
  Divider,
  List,
  Select,
  Switch,
  Table,
  Transfer,
  TreeSelect,
} from 'infrad';
import React, { useState } from 'react';

const customizeRenderEmpty = () => (
  <div style={{ textAlign: 'center' }}>
    <SmileOutlined style={{ fontSize: 20 }} />
    <p>Data Not Found</p>
  </div>
);

const style = { width: 200 };

const App: React.FC = () => {
  const [customize, setCustomize] = useState(false);

  return (
    <div>
      <Switch
        unCheckedChildren="default"
        checkedChildren="customize"
        checked={customize}
        onChange={val => {
          setCustomize(val);
        }}
      />

      <Divider />

      <ConfigProvider renderEmpty={customize ? customizeRenderEmpty : undefined}>
        <div className="config-provider">
          <h4>Select</h4>
          <Select style={style} />

          <h4>TreeSelect</h4>
          <TreeSelect style={style} treeData={[]} />

          <h4>Cascader</h4>
          <Cascader style={style} options={[]} showSearch />

          <h4>Transfer</h4>
          <Transfer />

          <h4>Table</h4>
          <Table
            style={{ marginTop: 8 }}
            columns={[
              {
                title: 'Name',
                dataIndex: 'name',
                key: 'name',
              },
              {
                title: 'Age',
                dataIndex: 'age',
                key: 'age',
              },
            ]}
          />

          <h4>List</h4>
          <List />
        </div>
      </ConfigProvider>
    </div>
  );
};

export default App;
empty
Customize Description

Customize image source, image size, description and extra content.

expand codeexpand code
import { Button, Empty } from 'infrad';
import React from 'react';

const App: React.FC = () => (
  <Empty
    image="https://gw.alipayobjects.com/zos/antfincdn/ZHrcdLPrvN/empty.svg"
    imageStyle={{
      height: 60,
    }}
    description={
      <span>
        Customize <a href="#API">Description</a>
      </span>
    }
  >
    <Button type="primary">Create Now</Button>
  </Empty>
);

export default App;

Simplest Usage with no description.

expand codeexpand code
import { Empty } from 'infrad';

const App: React.FC = () => <Empty description={false} />;

export default App;

API#

<Empty>
  <Button>Create</Button>
</Empty>
PropertyDescriptionTypeDefaultVersion
descriptionCustomize descriptionReactNode-
imageCustomize image. Will treat as image url when string providedReactNodeEmpty.PRESENTED_IMAGE_DEFAULT
imageStyleThe style of imageCSSProperties-

Built-in images#

  • Empty.PRESENTED_IMAGE_SIMPLE

  • Empty.PRESENTED_IMAGE_DEFAULT