GithubHelp home page GithubHelp logo

killfill / om-material-ui Goto Github PK

View Code? Open in Web Editor NEW

This project forked from taylorsando/om-material-ui

0.0 2.0 0.0 2.24 MB

A simple wrapper around react MaterialUI

License: Eclipse Public License 1.0

Clojure 10.17% HTML 0.01% JavaScript 89.81% CSS 0.01%

om-material-ui's Introduction

om-material-ui

A simple wrapper around React MaterialUI. It is basically like bootstrap-cljs.

Usage

Clojars Project

The sample is located at:

cd examples/simple

lein cljsbuild once simple

Then going to resources/public/index.html in a browser

You should see a very basic input box, material ui-style.

Accessing component methods

Most material-ui react components have methods to control their behaviour. For example, TextField has getValue() to retrieve its value (amongst others). To access these you must get the raw react component.

Using the folowing function, the raw react component can be retrieved using :ref:

(defn get-ref [owner ref]
  (aget (.-refs owner) ref))

Then, given this text field component:

(mui/text-field
  {:ref "text"})

You can get its value using (.getValue (get-ref owner "text"))

Avoid loading React twice

By default, when adding om as a :dependency in the project, it will include react. material.js does that too, so you page will load react twice and probably will see a message like this in the console:

Uncaught TypeError: Cannot read property 'firstChild' of undefined

A way to avoid this problem is to make om not include react, and just use the one in material.js. In the project.clj file, include Om as follow: [org.omcljs/om "0.8.8" :exclusions [cljsjs/react]]

then create a react.cljs file: mkdir src/cljsjs; echo "(ns cljsjs.react)" > src/cljsjs/react.cljs

License

Copyright © 2015 FIXME

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

om-material-ui's People

Contributors

taylorsando avatar killfill avatar danielytics avatar

Watchers

 avatar James Cloos 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.