material-ui

How to setup Material-UI for React with Typescript?

痞子三分冷 提交于 2019-12-03 18:34:20
问题 I've run in some problems add Material UI to my React project, which is programmed with Typescript. According to the tutorial, I start with adding the react-tab-event-plugin first. import injectTapEventPlugin from 'react-tap-event-plugin'; // Needed for onTouchTap // Can go away when react 1.0 release // Check this repo: // https://github.com/zilverline/react-tap-event-plugin injectTapEventPlugin(); Doing this, I get an error about the missing default export. ERROR in ./src/index.tsx (4,8):

How can i change TextField underline hover color by theme palette?

♀尐吖头ヾ 提交于 2019-12-03 17:22:46
material-ui v1 How can I change TextField underline hover color by theme palette? I know it possible by overrides , but how it can work for all components by standart palette options? like: const themeMui = createMuiTheme({ palette: { primary: lightBlue, secondary: blue, error: red, common: { darkBlack: blue.A700, } } }); What exactly CSS code I want to change: Djtouchette Hey I realize this is a bit old, but I have been having the same problem. I came up with this. Hope it helps... there docs are not the best on this! const theme = createMuiTheme({ overrides: { MuiInput: { underline: { color:

Is it possible to use material-ui button navigation with react-router?

China☆狼群 提交于 2019-12-03 17:11:23
问题 I have a web app that I'd designed with material-UI and I'm using Button navigation for navigating through my basic landing page component. <div className="footer"> <BottomNavigation value={value} onChange={this.handleChange} className={classes.root}> <BottomNavigationAction label="signal" value="signal" icon={<ShowChart />} className={classes.content}/> <BottomNavigationAction label="hotlist" value="hotlist" icon={<HotList />} className={classes.content}/> <BottomNavigationAction label=

styled-components typescript error with Material-UI component

主宰稳场 提交于 2019-12-03 14:52:55
Using typescript and want to set styling for Material UI component with styled-components. But type error happens with StyledComponent showing Type '{ children: string; }' is missing the following properties import React, { PureComponent } from 'react'; import styled from 'styled-components'; // ^4.1.3 import { Button } from '@material-ui/core'; // ^3.9.1 class TestForm extends PureComponent { render() { return ( <> <Button style={{ backgroundColor: 'red' }}>Work</Button>{/* OK */} <StyledButton>Doesn't work</StyledButton>{/* Type Error happens here <=============== */} {/** Type '{ children:

Material-ui @next customize button colors?

ぃ、小莉子 提交于 2019-12-03 13:00:27
I am struggling to modify button colors in Material-UI@next (v1). How would I set muitheme to behave similarity to bootstrap, so I could just use "btn-danger" for red, "btn-success" for green... ? I tried with custom className but it doesn't work properly (hover color does't change) and it seems repetitive. What options do I have? I came up with this solution using Brendans answer in this thread. Hopefully it'll help someone in a similar situation. import React, { Component } from 'react' import { MuiThemeProvider, createMuiTheme } from 'material-ui/styles' import Button from 'material-ui

How to wrap React component with little performance penalty?

[亡魂溺海] 提交于 2019-12-03 11:36:06
问题 My team uses React MaterialUI library. To provide consistent UI Pattern and make it easy for us to customise MaterialUI's component, we wrap each MaterialUI's component in our own component. For example: const style = {} // our project custom style for ListItemText const OurListItemText = ({primary, secondary, classes}: Props) => ( <MuiListItemText primary={primary} secondary={secondary} className={classes.text} /> ) // we only expose primary and secondary props of the original

Creating a navbar with material-ui

£可爱£侵袭症+ 提交于 2019-12-03 10:52:07
问题 I'm trying to create a simple navbar with material-ui that looks like the one they use on their site. This is the code I wrote to try to replicate it: import React from 'react' import {AppBar, Tabs, Tab} from 'material-ui' class Nav extends React.Component { render() { return ( <AppBar title="My App"> <Tabs> <Tab label="Item 1" /> <Tab label="Item 2" /> <Tab label="Item 3" /> <Tab label="Item 4" /> </Tabs> </AppBar> ) } } React.render(<Nav />, document.body) The problem is, the tabs are

Material-UI's Tabs integration with react router 4?

浪子不回头ぞ 提交于 2019-12-03 10:37:22
问题 The new react rotuer syntax uses the Link component to move around the routes. But how could this be integrated with materiaul-ui ? In my case, I'm using tabs as the main navigation system, So in theory I should have something like this: const TabLink = ({ onClick, href, isActive, label }) => <Tab label={label} onActive={onClick} /> export default class NavBar extends React.Component { render () { return ( <Tabs> <Link to="/">{params => <TabLink label="Home" {...params}/>}</Link> <Link to="

Use Create-React-App with Material UI

我怕爱的太早我们不能终老 提交于 2019-12-03 08:37:44
问题 I'm new to Material UI and ReactJS. I've been playing around with Create-React-App (CRA) and reactstrap. My question is, can I use Material UI and CRA together to build an app? 回答1: First install material-ui npm install --save material-ui or yarn add material-ui src/App.js import React, { Component } from 'react'; import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'; // add import RaisedButton from 'material-ui/RaisedButton'; // add import logo from './logo.svg'; import './App

Is it possible to use material-ui button navigation with react-router?

吃可爱长大的小学妹 提交于 2019-12-03 06:04:47
I have a web app that I'd designed with material-UI and I'm using Button navigation for navigating through my basic landing page component. <div className="footer"> <BottomNavigation value={value} onChange={this.handleChange} className={classes.root}> <BottomNavigationAction label="signal" value="signal" icon={<ShowChart />} className={classes.content}/> <BottomNavigationAction label="hotlist" value="hotlist" icon={<HotList />} className={classes.content}/> <BottomNavigationAction label="analyze" value="analyze" icon={<PieChart />} className={classes.content}/> <BottomNavigationAction label=