All Projects β†’ tiagofernandez β†’ mui-querybuilder

tiagofernandez / mui-querybuilder

Licence: MIT license
Query builder for React applications based on Material-UI.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to mui-querybuilder

react-firebase-template
Bootstrap a React + Firebase full stack application with every thing you need pre-configured: hosting, database, authentication, CI, Typescript, Material UI, PWA and other goodies.
Stars: ✭ 24 (-52%)
Mutual labels:  material-ui
spax
[WIP] πŸš€ a framework for building frameworks
Stars: ✭ 22 (-56%)
Mutual labels:  material-ui
react-declarative
A React form builder which interacts with a JSON endpoint to generate nested 12-column grids with input fields and automatic state management in a declarative style. Endpoint is typed by TypeScript guards (IntelliSense available). This tool is based on material-ui components, so your application will look beautiful on any device...
Stars: ✭ 17 (-66%)
Mutual labels:  material-ui
logi-filter-builder
advanced SQL filter builder. Demo:
Stars: ✭ 23 (-54%)
Mutual labels:  material-ui
swing-material
A collection of Material Design components and utilities for Swing.
Stars: ✭ 52 (+4%)
Mutual labels:  material-ui
media-picker
Easy customizable picker for all your needs in Android application
Stars: ✭ 167 (+234%)
Mutual labels:  material-ui
amplify-material-ui
A Material-UI based implementation of aws amplify
Stars: ✭ 32 (-36%)
Mutual labels:  material-ui
twitter-spring-reactjs
🐦 Twitter Clone. Using Java, Spring Boot, PostgreSQL, S3 bucket, JWT, TypeScript, React.js, Redux-Saga, Material-UI
Stars: ✭ 47 (-6%)
Mutual labels:  material-ui
emusak-ui
This is a tool which allows you to download saves or mods for Nintendo Switch emulators using a compatible Emusak backend
Stars: ✭ 877 (+1654%)
Mutual labels:  material-ui
spring-javafx-material-design-admin
Aplicação desktop para Gerenciamento de estoque e vendas com Spring Boot, JavaFX e Material Design
Stars: ✭ 56 (+12%)
Mutual labels:  material-ui
Tracktor-ComposeUI
Track the progress of anything in one place
Stars: ✭ 25 (-50%)
Mutual labels:  material-ui
Google-Clone
A Google Clone which built with ReactJS. When you click Gmail button, you will be directed to my other project, Gmail Clone. You can search whatever you want and send realtime emails by clicking Gmail button!
Stars: ✭ 37 (-26%)
Mutual labels:  material-ui
website
Official dahliaOS website
Stars: ✭ 29 (-42%)
Mutual labels:  material-ui
GlowButton
Beautify your layouts with glowing buttons. Support with a ⭐️ Contributions are welcome! πŸ™Œ
Stars: ✭ 54 (+8%)
Mutual labels:  material-ui
spotify-stats
🎧 Your spotify profile's top artists and tracks with charts and playlist creator.
Stars: ✭ 73 (+46%)
Mutual labels:  material-ui
material
🎨 Materialize your forum with this Flarum extension that uses the latest guidelines.
Stars: ✭ 14 (-72%)
Mutual labels:  material-ui
Floral
Minimal design gallery app for Android.
Stars: ✭ 23 (-54%)
Mutual labels:  material-ui
react-hook-form-mui
Material-UI form components ready to use with react-hook-form
Stars: ✭ 113 (+126%)
Mutual labels:  material-ui
juno
RingCentral React Component library, make your app have the same user experience as RingCentral Apps.
Stars: ✭ 26 (-48%)
Mutual labels:  material-ui
material-ui-swing
β™₯️ A modern Material Design UI for Java Swing β™₯️
Stars: ✭ 255 (+410%)
Mutual labels:  material-ui

MUI-QueryBuilder

Query builder for React applications based on Material-UI.

npm package npm downloads

Installation

MUI-QueryBuilder is available as an npm package.

yarn add --exact mui-querybuilder \
    @date-io/[email protected] \
    @date-io/[email protected] \
    @material-ui/core \
    @material-ui/icons \
    @material-ui/lab \
    @material-ui/pickers \
    date-fns \
    prop-types

Usage

Here is a quick example to get you started:

import MuiQueryBuilder from "mui-querybuilder";

import React, { useState } from "react";
import ReactDOM from "react-dom";

const filters = [
    {
        label: "Article",
        options: [
            {
                label: "Title",
                value: "title",
                type: "text",
            },
            {
                label: "URL",
                value: "url",
                type: "text",
            },
        ],
    },
];

function App() {
    const [query, setQuery] = useState({
        combinator: "and",
        rules: [
            {
                field: "title",
                operator: "contains",
                value: "France",
            },
        ],
    });
    return (
        <MuiQueryBuilder
            filters={filters}
            query={query}
            onChange={(query, valid) => {
                setQuery(query);
            }}
        />
    );
}

ReactDOM.render(<App />, document.querySelector('#app'));

Examples

Check out some examples in here!

API

Types

  • date: renders a date picker, date only.
  • integer: renders a text field that only accepts numbers.
  • number: renders a text field that only accepts fractional numbers.
  • multiselect: renders an autocomplete input for multiple items.
  • radio: renders radio buttons with true and false values.
  • select: renders an autocomplete input for a single item.
  • switch: renders an on/off switch input.
  • text: renders a text field.

Filters

The filters object is a list of grouped objects with label (string) and options (list) properties. Each option is an object with label (string), value (string), and type (string). The label can be anything, but the value must be an unique key, used by each field in a ruleset. In case an option's type is select or multiselect, it will require a nested options (list) property with label & value items.

Operators

In order to relate operators to their corresponding types, we rely on this data structure. Each operator must have a label (string), unique value (string), and the types (list) it supports.

Query

The query object is a recursive data structure composed of combinator (string) and rules (list) properties. Each rule is an object with field (string), operator (string), and value (anything, depending on the field's type). In case the rule contains a combinator property, it's considered a nested group.

Properties

Property Type Default Description
customOperators object {} Additional operators to be used by the query builder.
debug bool false Dev mode helper that renders the generated query directly in the screen.
filters array [] The filters the query builder framework will rely to create rules.
maxLevels number 1 The max nesting level, with 0 meaning no nesting at all.
operators array [...operators] The operators to be used, in case you want to change or translate the default ones.
onChange func null Function (query: object, valid: bool) => void with the current query and its validity (true if all rules have values).
query object { combinator: "and", rules: [{ field: null, operator: null, value: null }] } The initial query to be rendered.
sortFilters bool true Option to disable sorting filters within their groups.

Utility functions

import MuiQueryBuilder from "mui-querybuilder";

// Formats a query by deleting IDs from all nodes.
const formattedQuery = MuiQueryBuilder.formatQuery(query);

// Verifies if a query is valid, i.e. all rules and nested groups are filled.
const valid = MuiQueryBuilder.isQueryValid(query);

License

This project is licensed under the terms of the MIT license.

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].