Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to expand the width size of Input in Semantic React UI?

I'm working with Reactjs project, and I use Semantic UI React to beautify the Input. However, it seems that Input is always showed in default size. How can I resize its horizontal width ?

  • I follow the instruction on Semantic UI React Home page, I put this line of code to Html:

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

  • In js file I import:

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

  • and render the input:

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

like image 676
Khanh Tran Avatar asked Dec 24 '22 11:12

Khanh Tran


1 Answers

Adding style={{ width:"300px" }} works perfectly fine for me. I am using same stylesheet as that of you. You can take a look at following code:

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

Working example can be seen here:
Edit StackOverflow 2

like image 90
Swapnil Avatar answered Dec 31 '22 02:12

Swapnil