Skip to content

Admin

<Admin> is the root component of a shadcn-admin-kit application. It creates a series of context providers to allow its children to access the app configuration. It renders the main routes and layout. It delegates the rendering of the content area to its <Resource> children.

<Admin> requires only a dataProvider prop, and at least one child <Resource> to work. Here is the most basic example:

import { Admin } from "@/components/admin";
import { Resource } from 'ra-core';
import simpleRestProvider from 'ra-data-simple-rest';
import { PostList } from './posts';
const App = () => (
<Admin dataProvider={simpleRestProvider('http://path.to.my.api')}>
<Resource name="posts" list={PostList} />
</Admin>
);
export default App;

<Admin> children can be <Resource> and <CustomRoutes> elements.

Three main props lets you configure the core features of the <Admin> component:

  • dataProvider for data fetching
  • authProvider for security and permissions
  • i18nProvider for translations and internationalization

Here are all the props accepted by the component:

PropRequiredTypeDefaultDescription
dataProviderRequiredDataProvider-The data provider for fetching resources
childrenRequiredReactNode-The routes to render
accessDeniedOptionalComponent-The component displayed when users are denied access to a page
authCallbackPageOptionalComponentAuthCallbackThe content of the authentication callback page
authenticationErrorOptionalComponent-The component when an authentication error occurs
authProviderOptionalAuthProvider-The authentication provider for security and permissions
basenameOptionalstring-The base path for all URLs
catchAllOptionalComponentNotFoundThe fallback component for unknown routes
dashboardOptionalComponent-The content of the dashboard page
darkThemeOptionalobjectdefault DarkThemeThe dark theme configuration
defaultThemeOptionalbooleanfalseFlag to default to the light theme
disableTelemetryOptionalbooleanfalseSet to true to disable telemetry collection
errorOptionalComponent-A React component rendered in the content area in case of error
i18nProviderOptionalI18NProvider-The internationalization provider for translations
layoutOptionalComponentLayoutThe content of the layout
loginPageOptionalComponentLoginPageThe content of the login page
notificationOptionalComponentNotificationThe notification component
queryClientOptionalQueryClient-The react-query client
readyOptionalComponentReadyThe content of the ready page
requireAuthOptionalbooleanfalseFlag to require authentication for all routes
storeOptionalStore-The Store for managing user preferences
themeOptionalobjectdefault LightThemeThe main (light) theme configuration
titleOptionalstring-The error page title

To learn more about these props, refer to the <CoreAdmin> component documentation on the ra-core website.