I am using material-ui framework wrapped for clojurescript (reagent-material-ui) with reagent for a small desktop app .I was wondering, when I use the reagent/as-element
function to construct a React element can I pass props and style in it, and if so, how?
Looks like ragent-material-ui
is using cljsjs/material-ui "0.19.0-0"
. The applicable material-ui style docs are here.
I would give something like this a shot based off the documentation.
;; Using inline styles
(ns my.project
(:require [reagent-material-ui.core :as ui]
[reagent.core :as reagent]))
(reagent/as-element [ui/IconMenu
{:iconButtonElement
(el [ui/IconButton {:touch true} [icon "more_vert"]])
:style {}} ;; Your inline styles here
[ui/MenuItem "Delete"]])
;; Using component specific overrides
;; (depending on the type of element you are styling this will differ)
(reagent/as-element [ui/IconMenu
{:iconButtonElement
(el [ui/IconButton {:touch true} [icon "more_vert"]])
:listStyle {}} ;; Your root element overrides here
[ui/MenuItem "Delete"]])