@blackbox-vision/ra-layout
v0.0.30
Published
Custom layout for React Admin
Downloads
64
Readme
RA Layout
Revamped React Admin UI.
Install
You can install this library via NPM or YARN.
NPM
npm i @blackbox-vision/ra-layout
YARN
yarn add @blackbox-vision/ra-layout
Use case
You're tired of the defacto React Admin UI and want to renew the look and feel.
Usage
The usage is really simple:
- Define your menu as a JSON structure like the following:
// menu.ts
import {
LocalAtm,
PermContactCalendar,
} from '@material-ui/icons';
export const items = [{
type: 'group',
label: 'Architects',
items: [
{
type: 'resource',
name: 'architects',
label: 'Information',
icon: PermContactCalendar,
},
{
type: 'resource',
name: 'commissions',
label: 'Commissions',
icon: LocalAtm,
},
],
}]
- Import
Layout
pass props to it and you're ready:
// App.tsx
import React from 'react';
import { Admin } from 'react-admin';
import jsonServerProvider from 'ra-data-json-server';
import { Layout } from '@blackbox-vision/ra-layout';
import { items } from './menu';
const dataProvider = jsonServerProvider('https://jsonplaceholder.typicode.com');
export const App = () => {
return (
<Admin
dataProvider={dataProvider}
layout={props => <Layout {...props} items={items} />}
>
<Resource name="users" list={ListGuesser} />
</Admin>
);
};
App.displayName = "App";
Props
Layout
has the following props:
| Properties | Types | Default Value | Description | | ---------- | ------- | ------------- | ----------------------------------------------- | | items | Array | [] | The menu items to render |
Issues
Please, open an issue following one of the issues templates. We will do our best to fix them.
Contributing
If you want to contribute to this project see contributing for more information.
License
Distributed under the MIT license. See LICENSE for more information.