Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set width and height input with semantic-ui components

Hello i am new in the semantic world and I want to customize the default input height and width I know that we have predefined classes in semantic like small, big, mini but I need to have custom height and width.

In semantic documentation (http://semantic-ui.com/elements/input.html) at the input section we have this message:

"Inputs will automatically size themselves unless you manually declare a width"

I have declared the width in the input like this:

<input  width="10" type="text" value="test" placeholder="empty" readonly>

but it doesn't work for me. A little help please.

like image 875
quique Avatar asked Apr 20 '15 23:04

quique


3 Answers

Note: The width attribute is used only with <input type="image">. http://www.w3schools.com/tags/att_input_width.asp

That's why your code doesn't work. To make it work, you can do this:

<input style="width:100px; height: 100px;" type="text" value="test" placeholder="empty" readonly>

Or use a CSS file:

input[type="text"] {
    width: 100px;
    height: 100px;
}

You can change 100px to the width and height you want. Semantic UI won't set width and height for you, that's why they say manually declare a width.

like image 79
Henrique Arthur Avatar answered Oct 28 '22 22:10

Henrique Arthur


I tried successfully:

style={{minWidth:"10em"}}

for

<Form.Field width={3}><Select placeholder='Options' options={options} 
    style={{minWidth:"10em"}}/></Form.Field>
like image 35
Roman Avatar answered Oct 28 '22 22:10

Roman


You can set with for Semantic UI component using the style property.

It expects following syntax:

<Input style={{marginRight: spacing  'em'}}

In your example you should specify:

<Input style={{width: 100, height: 100}}
like image 42
raj chakravarthy Avatar answered Oct 28 '22 21:10

raj chakravarthy