I have followed the simple example on Matererial-UI
import React from 'react';
import DatePicker from 'material-ui/lib/date-picker/date-picker';
const DatePickerExampleSimple = () => (
<div>
<DatePicker hintText="Portrait Dialog" />
<DatePicker hintText="Landscape Dialog" mode="landscape" />
<DatePicker hintText="Dialog Disabled" disabled={true} />
</div>
);
But the output (image below) is not right, the blue label is not centered.
I am using: Material UI version 0.15.0-alpha.2, React 0.14.7, chrome 49
Am I missing something?
The DatePicker is being redesigned at the moment and this issue should be fixed among others soon.
Watch this Pull-Request for updates:
https://github.com/callemall/material-ui/pull/3739
If you need the layout fixed immediatly, use 0.15.0-alpha.1 or older
Related
How can i change datepicker dialog button text from OK to something like Apply. The MUI docs does not provide any props to help me change the title
You can simply pass okLabel prop to your datepicker component.
<DatePicker
okLabel={"Apply"}
{...props}
/>
In Material UI the components that display images have a parameter for the image. eg:
<Avatar alt="Remy Sharp" src="/static/images/avatar/1.jpg" />
In Next.js v10 there is a new Image component that automatically scales images: https://nextjs.org/docs/api-reference/next/image
Has anyone figured out how to use the new Image component with Material UI?
I am able to use it like this and it works well. I hope it will be helpful.
<Avatar className={className}>
<Image src={src || placeholder} alt={alt} layout="fill" />
</Avatar>
import image_1 from "/static/images/avatar/1.jpg" //locate image
then just replace
src="/static/images/avatar/1.jpg"
to
src={image_1.src}
I'm currently using the MS Fluent UI controls (formerly known as Office Fabric UI | https://developer.microsoft.com/en-us/fluentui#/controls/web) and I'm getting stuck with the 'Modal' control.
I am triggering a Modal dialog control as the onClick event for a DocumentCard control. The problem is I can't see any way to keep the new model dialog centred on the screen.
It appears to always center on the element which contains all of the document cards (and there are a lot of cards.. so you end up having to scroll down quite a lot to see the modal dialog).
Is there any way of simply setting it to "center on the (visible) window"?
Below is a snippet from the React Component which hosts the Document Card and Modal dialog..
return (
<DocumentCard onClick={showModal}>
<DocumentCardTitle title={this.props.Title} shouldTruncate />
<Image {...imageProps} className={styles.image} />
<DocumentCardTitle title={this.props.event.Description}
shouldTruncate showAsSecondaryTitle />
<Modal isOpen={isModalOpen} onDismiss={hideModal} isBlocking={true}>
<div>
<span id={titleId}>{this.props.Title}</span>
</div>
<div>
<p>
{this.props.event.Description}
</p>
</div>
</Modal>
</DocumentCard>
);
I think you just need to raise the modal out of the DocumentCard. The following might be what you're looking for
return (
<>
<DocumentCard onClick={showModal}>
<DocumentCardTitle title={this.props.Title} shouldTruncate />
<Image {...imageProps} className={styles.image} />
<DocumentCardTitle title={this.props.event.Description} shouldTruncate showAsSecondaryTitle />
</DocumentCard>
<Modal isOpen={isModalOpen} onDismiss={hideModal} isBlocking={true}>
<div>
<span id={titleId}>{this.props.Title}</span>
</div>
<div>
<p>{this.props.event.Description}</p>
</div>
</Modal>
</>
);
Old menu items broken with react-router-dom
<MenuItem
containerElement={<Link to="/module" />} >Module</MenuItem>
This stopped working....
How can I upgrade these new Menu Item controls to work with react-router?
I've tried replacing containerElement with root, and also surrounding by tag but that leaves the hyperlink underlined. I'd like to keep the same style as MenuItem.
from this post: How to do routing with material-ui#next MenuItem?
see demo.js from here https://codesandbox.io/s/5213wzkvpl
You can use Link as child for MenuItem:
<MenuList>
<MenuItem>
<Link to="/myRoute" style={{ textDecoration: 'none', display: 'flex' }}>
go to my route
</Link>
</MenuItem>
</MenuList>
How to style button with a standard SAPUI5 icon?
<Button
icon="sap-icon://notes"
text="Справки"
press="onOpenRef"
class=" sapThemeHighlight-asBackgroundColor "/>
It is necessary that the button was in the shape of a circle and green.
How can I do it (preferably standard SAPUI5 methods)?
Thank you.
To make it green, you could use the ButtonType Accept although that might carry some semantic meaning.
SAPUI5 itself doesn't offer a property on the Button to make it round, so you would have to use CSS instead.
To create a Button as in your image, add the style class roundButton and add the following CSS to your stylesheet:
.roundButton .sapMBtnInner {
border-radius: 2.5rem;
}
Creating the Button in XML:
<Button class="roundButton" icon="sap-icon://notes" tooltip="Справки" type="Accept" />
and JavaScript:
new sap.m.Button({
icon: "sap-icon://notes",
tooltip: "Справки",
type: "Accept"
}).addStyleClass("roundButton");