Giter Site home page Giter Site logo

csuffyy / react-uwp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from myxvisual/react-uwp

0.0 1.0 0.0 136.78 MB

📱⌨️ React Components that Implement Microsoft's UWP Design & Fluent Design.

Home Page: https://www.react-uwp.com

License: MIT License

TypeScript 99.39% JavaScript 0.36% CSS 0.24%

react-uwp's Introduction

img

react-uwp

cdnjs npm package Build Status

PeerDependencies Dependencies DevDependencies

React Components that Implement Microsoft's UWP Design & Fluent Design System.

Online Documentation

img Visit react-uwp.com online to review the API, see the components in action with live. Or build the documentation to locally.

Installation

React-UWP is available as an npm package.

Use NPM to get React-UWP components and core styling. All you need is node.js and gulp.

npm install --save react-uwp

Usage

React-UWP components require a theme to be provided. The quickest way to get up and running is by using the Theme to inject the theme into your application context.then, you can use any of the components as demonstrated in documentation.

If you coding by Typescript, add ReactUWP namespace to tsconfig.json.

{
  "compilerOptions": {
    "typeRoots": [
      "./node_modules/@types"
    ],
    "filesGlob": [
      "**/*.ts",
      "**/*.tsx"
    ],
    "files": [
      "node_modules/react-uwp/index.d.ts" // add to here.
    ]
  }
}

./App.js

import * as React from "react";
import * as ReactDOM from "react-dom";
import { Theme as UWPThemeProvider, getTheme } from "react-uwp/Theme";
import MyComponent from "./MyComponent";

export class App extends React.Component {
  render() {
    return (
      <UWPThemeProvider
        theme={getTheme({
          themeName: "dark", // set custom theme
          accent: "#0078D7", // set accent color
          useFluentDesign: true, // sure you want use new fluent design.
          desktopBackgroundImage: "http://127.0.0.1:8092/staticimages/jennifer-bailey-10753.jpg" // set global desktop background image
        })}
      >
        <MyComponent />
      </UWPThemeProvider>
    )
  }
}

ReactDOM.render(
  <App />,
  document.getElementById("app")
);

./MyComponent.js

import * as React from "react";
import Button from "react-uwp/Button";

export default class MyComponent extends React.Component<void, void> {
  render() {
    return (
      <Button tooltip="Mini Tooltip" />
    )
  }
}

Notice: that in the above example, we used:

import Button from "react-uwp/Button";

instead of

import { Button } from "react-uwp";

This will make your build process faster and your build output smaller.

For a complete mapping of React-UWP components to import, see /src/index.ts inside the React-UWP npm package root directory.

Custom Theme

We have implemented a default theme to render all React-UWP components. Styling components to your liking is simple and hassle-free. This can be achieved in the following two ways:

Four Theme Style (Fluent Design & UWP Design)

img

react-uwp's People

Contributors

caffeine-driven avatar dafrok avatar jokester avatar myxvisual avatar peterdanis avatar peterdavehello avatar wkich 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.