Material-ui: Style textAlign not working in TextField

Created on 27 Apr 2018  路  1Comment  路  Source: mui-org/material-ui

if we provide style attribute textAlign 'right | center' in the style attribute of TextField, text seems to be left aligned always.

Expected Behavior

it should align right, left or center according to the textAlign given

Current Behavior

Text stays left aligned always.

Steps to Reproduce (for bugs)

  1. use a text field component
  2. give style attribute and give textAlign to center or right

like this - https://jsfiddle.net/manuanalakkad/d0fxs637/6/

Context

I am trying to create a calculator kind of component in which I need to align text field to right which is currently not possible

Environment

| Tech | Version |
|--------------|---------|
| Material-UI | 0.20.0 |
| React | 16.3.2 |
| browser | chrome - 65.0.3325.181 |

TextField v0.x

Most helpful comment

@manu-codes Check the v1-beta branch out:

import React from "react";
import TextField from "material-ui/TextField";

function Align() {
  return (
    <TextField
      id="align"
      label="Label"
      defaultValue="foo"
      inputProps={{
        style: { textAlign: "right" }
      }}
    />
  );
}

export default Align;

https://codesandbox.io/s/23y18w9q10

>All comments

@manu-codes Check the v1-beta branch out:

import React from "react";
import TextField from "material-ui/TextField";

function Align() {
  return (
    <TextField
      id="align"
      label="Label"
      defaultValue="foo"
      inputProps={{
        style: { textAlign: "right" }
      }}
    />
  );
}

export default Align;

https://codesandbox.io/s/23y18w9q10

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chris-hinds picture chris-hinds  路  3Comments

rbozan picture rbozan  路  3Comments

zabojad picture zabojad  路  3Comments

mb-copart picture mb-copart  路  3Comments

reflog picture reflog  路  3Comments