5.43.1 • Published 10 months ago

@refinedev/antd v5.43.1

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

Discord Twitter Follow

It eliminates repetitive tasks in CRUD operations and provides industry-standard solutions for critical project components like authentication, access control, routing, networking, state management, and i18n.

Ant Design integration for Refine

Ant Design is a React.js UI library that contains easy-to-use components that are useful for building interactive user interfaces.

Refine is headless by design, offering unlimited styling and customization options. Moreover, Refine ships with ready-made integrations for Ant Design, Material UI, Mantine, and Chakra UI for convenience.

Refine has connectors for 15+ backend services, including REST API, GraphQL, and popular services like Airtable, Strapi, Supabase, Firebase, and NestJS.

Installation

To use Refine with Ant Design, you need to install the following package @refinedev/antd along with the Ant Design packages:

npm install @refinedev/antd antd

⚡ Try Refine

Start a new project with Refine in seconds using the following command:

npm create refine-app@latest my-refine-app

Or you can create a new project on your browser:

Quick Start

Here's Refine in action, the below code is an example of a simple CRUD application using Refine + React Router + Ant Design:

import { Refine } from "@refinedev/core";
import { ThemedLayoutV2 } from "@refinedev/antd";
import dataProvider from "@refinedev/simple-rest";
import routerBindings from "@refinedev/react-router-v6";
import { BrowserRouter, Outlet, Route, Routes } from "react-router-dom";

import "antd/dist/reset.css";

export default function App() {
  return (
    <BrowserRouter>
      <Refine
        dataProvider={dataProvider("https://api.fake-rest.refine.dev")}
        routerProvider={routerBindings}
        resources={[
          {
            name: "products",
            list: "/products",
          },
        ]}
      >
        <Routes>
          <Route
            element={
              <ThemedLayoutV2>
                <Outlet />
              </ThemedLayoutV2>
            }
          >
            <Route path="/products">
              <Route index element={<ProductList />} />
            </Route>
          </Route>
        </Routes>
      </Refine>
    </BrowserRouter>
  );
}

// src/pages/products/list.tsx

import { useMany } from "@refinedev/core";
import { List, useTable, DateField } from "@refinedev/antd";
import { Table } from "antd";

const ProductList = () => {
  const { tableProps } = useTable();

  const { data: categories, isLoading } = useMany({
    resource: "categories",
    ids:
      tableProps?.dataSource
        ?.map((item) => item?.category?.id)
        .filter(Boolean) ?? [],
    queryOptions: {
      enabled: !!tableProps?.dataSource,
    },
  });

  return (
    <List>
      <Table {...tableProps} rowKey="id">
        <Table.Column dataIndex="id" title="ID" />
        <Table.Column dataIndex="name" title="Name" />
        <Table.Column
          dataIndex="category"
          title={"Category"}
          render={(value) =>
            isLoading
              ? "Loading..."
              : categories?.data?.find((item) => item.id === value?.id)?.title
          }
        />
        <Table.Column
          dataIndex="createdAt"
          title="Created At"
          render={(value) => <DateField value={value} />}
        />
      </Table>
    </List>
  );
};

The result will look like this:

Refine + Ant Design Example

Documentation

5.43.1

10 months ago

5.39.0

1 year ago

5.42.0

12 months ago

5.43.0

11 months ago

5.40.0

1 year ago

5.41.0

12 months ago

5.38.1

1 year ago

5.38.0

1 year ago

5.37.6

1 year ago

6.0.0

1 year ago

5.37.5

1 year ago

5.37.4

1 year ago

5.37.3

1 year ago

5.37.3-alpha.0

1 year ago

5.37.2

1 year ago

5.37.1

1 year ago

5.37.0

2 years ago

5.29.0

2 years ago

5.36.0

2 years ago

5.34.2

2 years ago

5.36.1

2 years ago

5.34.0

2 years ago

5.34.1

2 years ago

5.32.0

2 years ago

5.30.0

2 years ago

5.28.0

2 years ago

5.35.0

2 years ago

5.33.0

2 years ago

5.31.0

2 years ago

5.36.8

2 years ago

5.36.9

2 years ago

5.36.6

2 years ago

5.36.7

2 years ago

5.36.4

2 years ago

5.36.5

2 years ago

5.36.2

2 years ago

5.36.3

2 years ago

5.36.19

2 years ago

5.36.17

2 years ago

5.36.18

2 years ago

5.36.15

2 years ago

5.36.16

2 years ago

5.36.13

2 years ago

5.36.14

2 years ago

5.36.11

2 years ago

5.36.12

2 years ago

5.36.10

2 years ago

5.27.0

2 years ago

5.18.2

2 years ago

5.18.1

2 years ago

5.18.0

2 years ago

5.16.2

2 years ago

5.16.1

2 years ago

5.16.0

2 years ago

5.25.0

2 years ago

5.23.0

2 years ago

5.21.0

2 years ago

5.14.0

2 years ago

5.19.0

2 years ago

5.17.0

2 years ago

5.26.0

2 years ago

5.24.0

2 years ago

5.22.0

2 years ago

5.20.0

2 years ago

5.13.2

2 years ago

5.13.1

2 years ago

5.13.0

2 years ago

5.12.0

2 years ago

5.11.0

2 years ago

5.10.0

2 years ago

5.9.0

2 years ago

5.7.0

2 years ago

5.6.0

2 years ago

5.5.2

2 years ago

5.5.1

2 years ago

5.5.0

2 years ago

5.4.0

2 years ago

5.3.14

2 years ago

5.3.13

2 years ago

5.3.12

2 years ago

5.3.11

2 years ago

5.3.10

2 years ago

5.3.9

2 years ago

5.3.8

2 years ago

5.3.7

2 years ago

5.3.6

2 years ago

5.3.5

2 years ago

5.3.4

2 years ago

5.3.3

2 years ago

5.3.2

2 years ago

5.3.1

2 years ago

5.3.0

2 years ago

5.2.0

2 years ago

5.1.2

2 years ago

5.1.1

2 years ago

5.1.0

2 years ago

5.0.0

2 years ago