If I have form input which label --> I cannot reduce the size of the label.
In this example fontSize will not be applied:
<Form.Input label="Username" style={{fontSize: '10px'}} />
Does someone has an idea about how to solve the issue?
Can you try this simple way to apply css on any component.
.inputCls { font-size: 10px !important; }
<Form.Input label="Username" className="inputCls" />
There is a cleaner approach which is also demonstrated in the official docs .
Instead of:
<Form.Input label="Username" style={{fontSize: '10px'}} />
Pass an object with style preferences to the label prop as follows:
<Form.Input label={{ children: "Username", style:{ fontSize: '10px' } }} />
I think you need to split label and input like this below than you can use inline styling:
<Form.Input label='Enter Password' type='password' />
vs
<Form.Field>
<label style={{fontSize: '10px'}}>Enter Password</label>
<Input type='password' style={{fontSize: '10px'}} />
</Form.Field>
If you can't create external CSS
files and rules, you can't override the Label
's styling with Form.Input
.
But that's only the "shorthand" (compound) version for:
<Form.Field>
<label>Enter text</label>
<Input type='text' />
</Form.Field>
And with this approach you can override the Label
styling:
<Form.Field>
<label style={{fontSize: '15px'}}>Enter text</label>
<Input type='text' />
</Form.Field>
See the docs
Here's how to customize semantic-ui input font size without the need to create a custom class or use !important.
input.css
) and add the following rule:.ui.input > input {
font-size: 10px;
}
import './input.css'
Boom! Input font size adjusted.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.