Giter VIP home page Giter VIP logo

mui-spfx-controls's Introduction

SPFx Material-UI Component Library

License: MIT

This is a SharePoint Framework (SPFx) component library built using Material-UI (MUI). It provides reusable React components for building modern and visually appealing user interfaces in SharePoint.

Installation

To install this component library in your SPFx project, you can use npm:

npm install mui-spfx-controls --save

Usage

Once installed, you can import and use the components in your SPFx web part or extension. Alternatively, prebuilt webparts can be used after deploying solution to site's AppCatalog For example:

import * as React from 'react';
import * as ReactDom from "react-dom";
import { BaseClientSideWebPart } from '@microsoft/sp-webpart-base';
import { PeoplePicker, IPeoplePickerProps } from 'mui-spfx-controls';

export default class PeoplePickerWebPart extends BaseClientWebPart {
  public render(): void {
    const element = React.ReactElement<IPeoplePickerProps> = React.createElement(
      PeoplePicker,
      {
        context: this.context,
        label: "People",
        size: "small",
        disabled: false,
        variant: "outlined",
        tagVariant: "filled",
        color: "primary",
        tagColor: "secondary",
      }
    );
    ReactDom.render(element, this.domElement);
  }
}
import * as React from 'react';
import * as ReactDom from "react-dom";
import { BaseClientSideWebPart } from '@microsoft/sp-webpart-base';
import { Dashboard, IDashboardProps } from 'mui-spfx-controls';

export default class PeoplePickerWebPart extends BaseClientWebPart {
  public render(): void {
    const element = React.ReactElement<IDashboardProps> = React.createElement(
      Dashboard,
      {
        context: this.context,
        list: "ListName",
        fields: ["Field1", "Field2", "Field3", "Field4", ],
        height: 750,
      }
    );
    ReactDom.render(element, this.domElement);
  }
}

Components

PeoplePicker

A SharePoint people picker component with MUI library integration

Props

  • context (required): SP context
  • label (required): Textfield label
  • onSelectionChange (optional): Get selection value updates
  • searchSuggestionLimit (optional): number of suggestions to provide
  • disabled (optional): Is component disabled
  • variant (optional): Textfield variant ('standard', 'outlined', 'filled')
  • tagVariant (optional): Chip variant ('filled', 'outlined')
  • color (optional): Button color, e.g., "primary" or "secondary"
  • tagColor (optional): Chip color, e.g., "default" or "secondary"
  • size (optional): Size of component
  • LoadingComponent (optional): A loading component
  • styles (optional): Styles to apply
  • sx (optional): MUI's sx prop

Dashboard

A dashboard component with MUI Data Grid

Props

  • context (required): SP context
  • list (required): SharePoint list to pull data from
  • fields (required): Internal Name of fields to display in dashboard
  • height (optional): Absolute or relative container height
  • sx (optional): MUI's sx prop

Development

If you want to contribute to the library, you can follow these steps:

Clone the repository:

git clone https://github.com/anapeksha/mui-spfx-controls.git

Install dependencies:

cd mui-spfx-controls
npm install

Serve the solution

npm run serve:fast

Test the components/webparts in a sample SPFx project

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

mui-spfx-controls's People

Contributors

anapeksha avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.