6

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 ?

<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}/>

3
  • I've tried this style={{ width: "300px" }} but still didn't work. Commented Jan 15, 2018 at 4:55
  • If you take a look at the props for the Input component (react.semantic-ui.com/elements/input) you will see that style is not listed. However, className is, so you should be able to pass in a class that will do the same thing. Commented Jan 15, 2018 at 5:06
  • thanks for your response. Commented Jan 15, 2018 at 8:55

1 Answer 1

14

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.