react-admin icon indicating copy to clipboard operation
react-admin copied to clipboard

Required Field Inline Styling Offsets

Open JTCE opened this issue 9 years ago • 2 comments

Good day folks,

Love your product and when/if time permits I will certainly do my very best to contribute! But currently having the following issue and I'm new to React, Node etc.

Following is an excerpt from a test performed for a required field and inline styling. If the TextInput is derived from admin-on-rest, the element having text entered offsets below the adjacent element. They are still correctly spaced horizontally but vertically misaligned. This does not happen if deriving directly from material-ui TextField.

Any ideas? Code snippet and screen shots below. Thanks!

import TextInput from 'admin-on-rest/lib/mui';
import MUITextField from 'material-ui/TextField';

export const FormCreate = (props) => (
    <Create {...props}>
        <SimpleForm>
            <MUITextField hintText="MUI Name" errorText="This field is required" style={{ display: 'inline-block', marginRight: 32 }} />
            <MUITextField hintText="MUI Location" errorText="This field is required" style={{ display: 'inline-block' }}/>
            <br />
            <TextInput label="AOR Name" source="name" style={{ display: 'inline-block', marginRight: 32 }} validation={{ required: true }} />
            <TextInput label="AOR Location" source="location" style={{ display: 'inline-block' }} validation={{ required: true }} />
        </SimpleForm>
    </Create>
);

Before: before

After: after

JTCE avatar Jan 27 '17 17:01 JTCE

Additional info: Adding the attribute "float" to inline styling solves the issue, example:

<TextInput label="AOR Name" source="name" style={{ display: 'inline-block', float: 'left', marginRight: 32 }} validation={{ required: true }} />

I'm unsure how Material-UI is defaulting the float to left but raises the question if admin-on-rest is utilizing all the raw properties from MUI?

JTCE avatar Jan 29 '17 18:01 JTCE

Closing for no activity as a workaround exists.

JTCE avatar Feb 06 '17 19:02 JTCE