Socket
Socket
Sign inDemoInstall

define-react-admin-components

Package Overview
Dependencies
18
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    define-react-admin-components

This is a component library that aims to simplify the creation of admin panels and dashboards. This library aims to build ontop of other popular open source libraries namely Material UI, Tanstack Query, React Hook Forms and others.


Version published
Weekly downloads
1
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Getting Started with React Admin Components

This is a component library that aims to simplify the creation of admin panels and dashboards. This library aims to build ontop of other popular open source libraries namely Material UI, Tanstack Query, React Hook Forms and others.

####Usage

Wrap the root of the application with Tanstack Query provider

const queryClient = new QueryClient();
<QueryClientProvider client={queryClient}>
  // You root of app here
</QueryClientProvider>;

####Listings

<ListingProvider>

    // Filters
    <ListingSearchBar />
    <ListingMultiSelect />

    // Actual Listing
    <Listing>

</ListingProvider>

ListingProvider is a context that manages the filters for the listing page and pass the filters for the <Listing />. Pagination is being handled under the Listing component.

Please check the here for the basic usage. The system is strongly typed for developers to strongly understand what Resource that we are working on.

Sample:

Sample Image

Provided Components

  1. ListingAdvanceFilter A side bar drawer where is holds different filters components. Sample Image
  2. ListingFilterDisplay Displays the applied filters. The filters can be canceled and reset Sample Image
  3. ListingFilterDropdown Select one filter Sample Image
  4. ListingMultiSelect Select multiple filter Sample Image
  5. ListingSearchBar Search bar Sample Image

Check the Generated filters formats here. This format can be transformed to the shape that you want

Headless Usage

To create your own filter component

    const { value: V, onChange: (value:V) => void, resetFilter: ()=> void } = useFilterController<T, V>({
        queryFunc: (v: T) => TFilter<T>,
        name: string,
  });

To create your own listing component just use this hook

    function useListingCore<T>({
        queryFunc: TQueryListFunc<T>;
        columns: GridColumns<T>;
        defaultLimit?: number;
        listingKey: string;
        onSuccess?: (data: {
            nextToken: string;
            total: number;
            items: T[];
        }) => void;
    }) => ({
        setSortModel: React.Dispatch<React.SetStateAction<GridSortItem[]>>;
        setLimit: React.Dispatch<React.SetStateAction<number>>;
        setPage: React.Dispatch<React.SetStateAction<number>>;
        sortModel: GridSortItem[];
        isLoading: boolean;
        limit: number;
        page: number;
        data: any;
    })

FAQs

Last updated on 23 Jan 2023

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc