Questions tagged [react-admin]

A frontend Framework for building admin applications running in the browser on top of REST/GraphQL APIs, using ES6, React and Material Design. Previously named admin-on-rest. Open sourced and maintained by marmelab.

Links

Features

  • Backend Agnostic: Connects to any API (REST or GraphQL, see the list of more than 45 adapters)

  • All The Building Blocks You Need: Provides hooks and components for authentication, routing, forms & validation, datagrid, search & filter, relationships, validation, roles & permissions, rich text editor, i18n, notifications, menus, theming, caching, etc.

  • High Quality: Accessibility, responsive, secure, fast, testable

  • Great Developer Experience: Complete documentation, IDE autocompletion, type safety, storybook, demo apps with source code, modular architecture, declarative API

  • Great User Experience: Optimistic rendering, filter-as-you-type, undo, preferences, saved queries

  • Complete Customization: Replace any component with your own

  • ☂️ Opt-In Types: Develop either in TypeScript or JavaScript

  • ‍‍‍ Powered by MUI, react-hook-form, react-router, react-query, TypeScript and a few more.

At a Glance

// in app.js
import * as React from "react";
import { render } from 'react-dom';
import { Admin, Resource } from 'react-admin';
import restProvider from 'ra-data-simple-rest';

import { PostList, PostEdit, PostCreate, PostIcon } from './posts';

render(
    <Admin dataProvider={restProvider('http://localhost:3000')}>
        <Resource name="posts" list={PostList} edit={PostEdit} create={PostCreate} icon={PostIcon} />
    </Admin>,
    document.getElementById('root')
);

The <Resource> component is a configuration component that allows to define sub components for each of the admin view: list, edit, and create. These components use MUI and custom components from react-admin:

// in posts.js
import * as React from "react";
import { List, Datagrid, Edit, Create, SimpleForm, DateField, TextField, EditButton, TextInput, DateInput, useRecordContext } from 'react-admin';
import BookIcon from '@mui/icons-material/Book';
export const PostIcon = BookIcon;

export const PostList = () => (
    <List>
        <Datagrid>
            <TextField source="id" />
            <TextField source="title" />
            <DateField source="published_at" />
            <TextField source="average_note" />
            <TextField source="views" />
            <EditButton />
        </Datagrid>
    </List>
);

const PostTitle = () => {
    const record = useRecordContext();
    return <span>Post {record ? `"${record.title}"` : ''}</span>;
};

export const PostEdit = () => (
    <Edit title={<PostTitle />}>
        <SimpleForm>
            <TextInput disabled source="id" />
            <TextInput source="title" />
            <TextInput source="teaser" options={{ multiline: true }} />
            <TextInput multiline source="body" />
            <DateInput label="Publication date" source="published_at" />
            <TextInput source="average_note" />
            <TextInput disabled label="Nb views" source="views" />
        </SimpleForm>
    </Edit>
);

export const PostCreate = () => (
    <Create title="Create a Post">
        <SimpleForm>
            <TextInput source="title" />
            <TextInput source="teaser" options={{ multiline: true }} />
            <TextInput multiline source="body" />
            <TextInput label="Publication date" source="published_at" />
            <TextInput source="average_note" />
        </SimpleForm>
    </Create>
);
1781 questions
0
votes
2 answers

React-admin TextField in List component shows "null". Can I convert this to blank?

I'm new to React and react-admin, so maybe I'm doing something wrong. My api returns records from MySQL and null fields are returned as "null". In the record list showing up on the client, the field is also showing "null". Can I translate this to…
Dan G.
  • 529
  • 8
  • 21
0
votes
2 answers

react-admin support for WordPress API?

My team is attempting to get react-admin working with the WordPress REST API. We need all the standard functionality you'd expect, including filtering, sorting, and associations. The issue is that the WordPress REST API follows slightly different…
mholubowski
  • 125
  • 9
0
votes
1 answer

React-Admin: How do I call two endpoints simultaneously from one click event within a

So I have a form that contains the data about two tables on the backend: table zone, and table area Normally, the update method in react-admin is just straight forward, but in this case not really.So I have taken the data from the zone and area…
0
votes
1 answer

Which Backend technology would be best for my React-Admin App? (Simple online Database)

I want to create a simple Web-Database but am unsure which technology to use. My goal: Create a simple Web Application which I, as well as two of my partners can use to track addresses and projects. (So about 6 DB tables + some support tables for…
Timothy Lukas H.
  • 684
  • 2
  • 9
  • 19
0
votes
1 answer

React-Admin: is stuck in loading state, even though data fetch succeeds

I have problem with . On my page, I have rows with UserId and ToolId that I need reference. I want to show user name and tool code. But these two columns get stuck in loading state, even though the dataProvider, GET_MANY…
0
votes
3 answers

Use a button to clear multiple fields in react-admin edit form

I've got an Edit form using react-admin, and I'm trying to figure out how to add a button to clear some of the fields on click. The relevant chunk of form: const ProfileEdit = withDataProvider(( {...props}:{ record: ProfileRecord, …
StephenTG
  • 2,579
  • 6
  • 26
  • 36
0
votes
1 answer

how to separate form data and file field

I have a product form:
0
votes
2 answers

How to change the delete confirmation dialog title?

The delete confirmation dialog show the resource name and #id as title. How to change this title to the one defined in Edit object where undoable={false} is set ? And for the bulk delete confirmation dialog it takes the resource name instead of the…
Christophe
  • 85
  • 7
0
votes
1 answer

Change/altering the form value before submit

We're using react-admin react-admin docs I've got a form with fields productName, Price and Image. Image field has a string type, that means Upload an image to s3 or any other destination and pass uploaded image URL to image field dynamically. I've…
Dhaval
  • 1,393
  • 5
  • 29
  • 55
0
votes
0 answers

How can I add translate to validation in React Admin?

I can't translate the validation message in React Admin . The validation return only the validated string (example.: app.errors.startIsRequired, not the translated string (example: Start is required). Example: Form.js
Joci93
  • 803
  • 3
  • 10
  • 24
0
votes
1 answer

Can I display filter settings in the ReactAdmin app bar?

Is it possible to display elements of my current filter in the ReactAdmin app bar? E.g. I have a team filter in order to show sales results for a given team in a company. This bit is all working. The filter ends up in the route as the team id, not…
MikeBeaton
  • 3,314
  • 4
  • 36
  • 45
0
votes
0 answers

Change locale from outside any component (not using useSetLocale hook)

I'm migrating my react-admin app to v3. It uses a custom redux-saga effect (USER_CHECK_SUCCESS) to call the changeLocale method but that's not supported anymore : https://marmelab.com/blog/2019/10/10/react-admin-v3-i18n.html Problem is, I don't know…
Armel Larcier
  • 15,747
  • 7
  • 68
  • 89
0
votes
1 answer

How to know when a user was last active?

Trying to build an auto-logout feature, and have got a timer going but looking for a way to start/restart the timer based on user's last active time. The scenario is that the user has been away from their keyboard for X amount of time, and we want…
0
votes
1 answer

Move filter-hide button to right - React-admin

Is there a way how to move filter close button to the right side of the input in React Admin ? Currently it appears always on left which is not really user friendly. Or at least remove the button at all so I can create a custom component ?
lorem321
  • 1
  • 1
0
votes
1 answer

React-Admin Localstorage Token Null

I use react-admin trying to access to an Restful API Node server. I can sign in, and i'm trying to list users, but i get error 401 Unauthorized. In the request headers: authorization: Bearer null And the server return the error: JsonWebTokenError:…
Ludo
  • 103
  • 1
  • 15
1 2 3
99
100