![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@refinedev/chakra-ui
Advanced tools
Chakra UI support for Refine, providing flexible and accessible UI components.
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.
Chakra UI is a simple, modular and accessible component library that gives you the building blocks you need to build your React applications.
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.
To use Refine with Chakra UI, you need to install the following package @refinedev/chakra-ui
along with the Chakra UI packages:
npm install @refinedev/chakra-ui @chakra-ui/react @emotion/react @emotion/styled framer-motion
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:
Here's Refine in action, the below code is an example of a simple CRUD application using Refine + React Router + Chakra UI:
import React from "react";
import { Refine } from "@refinedev/core";
import {
ErrorComponent,
ThemedLayoutV2,
RefineThemes,
useNotificationProvider,
} from "@refinedev/chakra-ui";
import dataProvider from "@refinedev/simple-rest";
import routerBindings from "@refinedev/react-router";
import { BrowserRouter, Outlet, Route, Routes } from "react-router";
import { ProductList } from "./pages/products/list";
export default function App() {
return (
<BrowserRouter>
<ChakraProvider theme={RefineThemes.Blue}>
<Refine
routerProvider={routerBindings}
dataProvider={dataProvider("https://api.fake-rest.refine.dev")}
notificationProvider={useNotificationProvider()}
resources={[
{
name: "products",
list: "/products",
},
]}
options={{
syncWithLocation: true,
warnWhenUnsavedChanges: true,
}}
>
<Routes>
<Route
element={
<ThemedLayoutV2>
<Outlet />
</ThemedLayoutV2>
}
>
<Route path="/products">
<Route index element={<ProductList />} />
</Route>
<Route path="*" element={<ErrorComponent />} />
</Route>
</Routes>
</Refine>
</ChakraProvider>
</BrowserRouter>
);
}
// src/pages/products/list.tsx
import React from "react";
import { type GetManyResponse, useMany } from "@refinedev/core";
import { useTable } from "@refinedev/react-table";
import { List } from "@refinedev/chakra-ui";
import { type ColumnDef, flexRender } from "@tanstack/react-table";
import {
Table,
Thead,
Tbody,
Tr,
Th,
Td,
TableContainer,
HStack,
Text,
} from "@chakra-ui/react";
export const ProductList = () => {
const columns = React.useMemo<ColumnDef<IPost>[]>(
() => [
{
id: "id",
header: "ID",
accessorKey: "id",
},
{
id: "name",
header: "Name",
accessorKey: "name",
},
{
id: "category",
header: "Category",
accessorKey: "category",
cell: function render({ getValue, table }) {
const meta = table.options.meta as TableMeta;
const loading = meta.loading;
const categoriesData = meta.categoriesData;
const category = categoriesData?.data.find(
(item) => item?.id === getValue<IPost["category"]>()?.id,
);
if (loading) {
return "Loading...";
}
return category?.title ?? "-";
},
},
],
[],
);
const {
getHeaderGroups,
getRowModel,
setOptions,
refineCore: {
tableQuery: { data: tableData, isLoading: tableIsLoading },
},
} = useTable({
columns,
meta: {
categoriesData: [],
loading: true,
},
refineCoreProps: {
sorters: {
initial: [
{
field: "id",
order: "desc",
},
],
},
},
});
const categoryIds = tableData?.data?.map((item) => item.category?.id) ?? [];
const { data: categoriesData, isLoading: categoriesIsLoading } =
useMany<ICategory>({
resource: "categories",
ids: categoryIds,
queryOptions: {
enabled: categoryIds.length > 0,
},
});
const loading = tableIsLoading || categoriesIsLoading;
setOptions((prev) => ({
...prev,
meta: {
...prev.meta,
loading,
categoriesData,
},
}));
return (
<List>
<TableContainer whiteSpace="pre-line">
<Table variant="simple">
<Thead>
{getHeaderGroups().map((headerGroup) => (
<Tr key={headerGroup.id}>
{headerGroup.headers.map((header) => (
<Th key={header.id}>
{!header.isPlaceholder && (
<HStack spacing="2">
<Text>
{flexRender(
header.column.columnDef.header,
header.getContext(),
)}
</Text>
</HStack>
)}
</Th>
))}
</Tr>
))}
</Thead>
<Tbody>
{getRowModel().rows.map((row) => (
<Tr key={row.id}>
{row.getVisibleCells().map((cell) => (
<Td key={cell.id}>
{flexRender(cell.column.columnDef.cell, cell.getContext())}
</Td>
))}
</Tr>
))}
</Tbody>
</Table>
</TableContainer>
</List>
);
};
type TableMeta = {
loading: boolean;
categoriesData: GetManyResponse<ICategory>;
};
type ICategory = {
id: number;
title: string;
};
type IPost = {
id: number;
title: string;
content: string;
status: "published" | "draft" | "rejected";
category: { id: number };
};
The result will look like this:
FAQs
Chakra UI support for Refine, providing flexible and accessible UI components.
The npm package @refinedev/chakra-ui receives a total of 0 weekly downloads. As such, @refinedev/chakra-ui popularity was classified as not popular.
We found that @refinedev/chakra-ui demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
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.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.