All Projects → ValentinnDimitroff → ra-compact-ui

ValentinnDimitroff / ra-compact-ui

Licence: MIT License
Enhanced components for popular framework react-admin. Helps reducing the styling boilerplate code and eases layout customizations.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to ra-compact-ui

Admin On Rest
A frontend framework for building admin SPAs on top of REST services, using React and Material Design.
Stars: ✭ 392 (+409.09%)
Mutual labels:  material-ui, react-admin
React Admin
A frontend Framework for building B2B applications running in the browser on top of REST/GraphQL APIs, using ES6, React and Material Design
Stars: ✭ 18,525 (+23958.44%)
Mutual labels:  material-ui, react-admin
Postgui
A React web application to query and share any PostgreSQL database.
Stars: ✭ 260 (+237.66%)
Mutual labels:  material-ui, react-admin
amplify-material-ui
A Material-UI based implementation of aws amplify
Stars: ✭ 32 (-58.44%)
Mutual labels:  material-ui, react-admin
sample-ui-react
Material-UI+ React.js + Redux [ Pug / Scss / Babel ]
Stars: ✭ 15 (-80.52%)
Mutual labels:  material-ui
max-todos
A basic Todo app developed in React.
Stars: ✭ 19 (-75.32%)
Mutual labels:  material-ui
SWoT
A web application for designing, tracking, and reporting progress on workouts. Written in JavaScript with React, Redux, Material UI, and hosted by a serverless AWS backend.
Stars: ✭ 14 (-81.82%)
Mutual labels:  material-ui
react-quiz-app
A Simple React Quiz App 💎
Stars: ✭ 37 (-51.95%)
Mutual labels:  material-ui
OmniList
开源的时间管理App,基于Material Design设计
Stars: ✭ 61 (-20.78%)
Mutual labels:  material-ui
svelteify
📲 Customizable and dependencies-less Material components with Svelte
Stars: ✭ 43 (-44.16%)
Mutual labels:  material-ui
react-mui-pro-starter
Mix of Create React App and Material UI with set of reusable components and utilities to build professional React Applications faster.
Stars: ✭ 14 (-81.82%)
Mutual labels:  material-ui
React-GitHub-Resume
React SPA that generates users GitHub resumé. showing information if available. showing users repositories if available with additional information.
Stars: ✭ 37 (-51.95%)
Mutual labels:  material-ui
material-ui-settings-panel
A settings component in material ui style inspired by google admin console and google inbox.
Stars: ✭ 15 (-80.52%)
Mutual labels:  material-ui
material-ui-markdown-editor
React.js Markdown editor component based on material-ui
Stars: ✭ 28 (-63.64%)
Mutual labels:  material-ui
Atomic-Periodic-Table.Android
Atomic - Periodic Table
Stars: ✭ 33 (-57.14%)
Mutual labels:  material-ui
boilerplate-electron-material-ui-react
Boilerplate for Electron with React and Material UI
Stars: ✭ 21 (-72.73%)
Mutual labels:  material-ui
chatty
A React single-page-application alternative client for the shacknews chatty.
Stars: ✭ 27 (-64.94%)
Mutual labels:  material-ui
FancyAboutPage-Android
Fancy About Page is a simple and lightweight library that helps you to create cool and beautiful about page for your apps without writing dozens of lines of code. It's a material-design about screen to use on your Android apps. A developer profile and application information easy to integrate.
Stars: ✭ 79 (+2.6%)
Mutual labels:  material-ui
TagField
🏷 Simple Tag Field for SwiftUI 🏷
Stars: ✭ 19 (-75.32%)
Mutual labels:  material-ui
soloalert
A customizable lightweight Alert Library with Material UI and awesome features.
Stars: ✭ 18 (-76.62%)
Mutual labels:  material-ui

ra-compact-ui

Enhanced styling components for popular framework react-admin.

No extra dependencies are required except the ones react-admin is already using.

Why using?

  • reduces styling boilerplate code
  • eases layout customizations
  • maintains native usage of built-in react-admin components

npm version npm downloads GitHub license PRs Welcome minzipped size styled with prettier

Actively maintained and developed with monthly releases!

Installation

Available as a npm package. You can install it using:

npm install ra-compact-ui
#or
yarn add ra-compact-ui

Run the Demo

npm run start-demo
#or
yarn start-demo

Table of Content

Show View

Create & Edit View

Examples

Show View Components

Layouts

Layout components which allow building custom Show Layouts using unlimited nesting of material-ui's Box or Grid components while maintaining native use of all of the react-admin field-related components. Each layout can be used inside the Show component as well as inside the TabbedShowLayout's Tab component.

Important - In order for the layouts to work properly you should use the provided wrappers of the material-ui's layout components named relatively - RaBox and RaGrid. They receive and pass directly all the props provided by the material-ui's api.


BoxedShowLayout

Utilizes material-ui's Box component wrapped inside RaBox and provides easy access to common css and flex-box properties.

const useStyles = makeStyles(theme => ({
    detailsBox: {
        paddingRight: "50px",
        borderRight: "solid thin",
        marginRight: "50px",
    },
}));

...

<BoxedShowLayout>
    <RaBox display="flex" >
        <RaBox display="flex" flexWrap="wrap" flexGrow={4} className={classes.detailsBox}>
            <RaBox flex="0 0 100%" display="flex" justifyContent="space-between">
                <ReferenceField label="Client Name" source="clientId" reference="clients">
                    <TextField source="name" />
                </ReferenceField>
                <ChipField source="progressStatus" label="Progress Status" />
                <TextField source="priority" />
            </RaBox>
            <RaBox flex="0 0 100%" display="flex" justifyContent="space-between">
                <DateField source="startDate" />
                <TextField source="timeElapsed" />
                <DateField source="deadline" />
            </RaBox>
        </RaBox>
        <RaBox display="inline-flex" flexDirection="column" flexGrow={1}>
            <ReferenceField label="Project Manager" source="managerId" reference="staff">
                <UserChipField source="fullName"  />
            </ReferenceField>
            <ReferenceField label="Product Owner" source="productOwnerId" reference="staff">
                <UserChipField source="fullName"  />
            </ReferenceField>
            <ReferenceField label="Marketing Specialist" source="marketingSpecialistId" reference="staff">
                <UserChipField source="fullName"  />
            </ReferenceField>
        </RaBox>
    </RaBox>
    <RaBox flex="0 0 100%" display="flex" mt="20px">
        <ArrayField source="activityRecords">
            <Datagrid>
                <DateField source="date" />
                <TextField source="description" />
                <TextField source="memberNames" />
            </Datagrid>
        </ArrayField>
    </RaBox>
</BoxedShowLayout>

image


GridShowLayout

Utilizes material-ui's Grid component wrapped inside RaGrid. Useful to align fields into rows and columns and make layout sections responsive.

Usage is asbolutely analogously to the BoxShowLayout.


CompactShowLayout

This layout is a more generic version allowing you to pass your own layout building blocks (components). It serves also as the base component wrapped by the above ones.

Pass to layoutComponents prop an array which specifies the used layout components to be escaped as non-field components while rendering.

Important - All layout components should have a specified displayName.

<CompactShowLayout layoutComponents={[CustomBox, RaBox]}>
    <CustomBox>
        <TextField source="name"/>
        <RaBox>
            <NumberInput source="age" />
        </RaBox>
    </CustomBox>
</CompactShowLayout>

ShowSplitter

Need to mix up different layouts on the same page and separate different sections? The <ShowSplitter/> component helps you do just that with ease.

  • Pass the component as single child to the <Show/> component.
  • Then pass your different layouts to the <ShowSplitter/>'s props leftSide and rightSide.

hint - to escape the default <Card/> surface provided by the <Show/> component pass your custom value, e.g. component="div".

import { ShowSplitter } from 'ra-compact-ui';

...

const StaffShow = props => (
    <Show
        {...props}
        component="div"
    >
        <ShowSplitter
            leftSide={
                <SimpleShowLayout>
                    <AvatarShowField />
                    <TextField source="full_name" />
                    <TextField source="email" />
                    <ArrayField source="skills">
                        <SingleFieldList>
                            <ChipField source="name" />
                        </SingleFieldList>
                    </ArrayField>
                </SimpleShowLayout>
            }
            rightSide={
                <TabbedShowLayout>
                    <Tab label="Overview">
                        <TextField source="description" />
                    </Tab>
                    <Tab label="Projects">
                        {/* add more fields here */}
                    </Tab>
                </TabbedShowLayout>
            }
        />
    </Show>
);

image

Override and customize the way the layout is split using the leftSideProps and rightSideProps props. You can pass objects with props which will be destructed to the respective material-ui's Grid components which wrap the passed layouts.

The component prop is also supported by each side of the split layout. Example values:

<ShowSplitter
    leftSideProps={{
        md: 4,
        component: 'div'
    }}
    rightSideProps={{
        md: 8
    }}
    leftSide={...}
    rightSide={...}
/>

Create & Edit View Components

CompactForm

Provides form layout customization out of the box just like using the <SimpleForm/>.

Pass to layoutComponents prop an array which specifies the used layout components to be escaped as non-input components while rendering.

Important - All layout components should have a specified displayName.

import { CompactForm, RaBox } from 'ra-compact-ui';

...

const StaffEdit = props => (
    <Edit {...props}>
        <CompactForm layoutComponents={[RaBox]}>
            <RaBox display="flex" justifyContent="space-around">
                <TextInput source="full_name" />
                <TextInput source="email" />
            </RaBox>
            <TextInput source="description" />
            <TextInput source="avatar_url" />
        </CompactForm>
    </Edit>
);

About Author

An enthusiast in 💖 with building software who likes to call it "the grown up's LEGO".

If you enjoy the library and want to support me, you can always Buy Me A Coffee

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].