如何在Semantic React UI中扩展Input的宽度大小?

时间:2018-01-15 04:43:20

标签: reactjs semantic-ui semantic-ui-react

我正在使用Reactjs项目,我使用Semantic UI React来美化Input。但是,似乎Input始终以默认大小显示。如何调整其水平宽度?

<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.12/semantic.min.css"></link>

  • 在js文件中我导入:

import { Input } from 'semantic-ui-react';

  • 并呈现输入:

<Input value={this.state.firstName} onChange={this.handleInputFirstName}/>

1 个答案:

答案 0 :(得分:0)

添加style={{ width:"300px" }}对我来说非常合适。我正在使用与你相同的样式表。您可以查看以下代码:

const App = () => (
  <div style={styles}>
    <h2>Start editing width and see magic happen {'\u2728'}</h2>
    <Input placeholder="Hello there" style={{width: "370px"}}/>
  </div>
);

这里可以看到工作实例:
Edit StackOverflow 2

相关问题