how to remove border-right/Left of material-ui Textfield? - css

how can i remove to "border-left" of the first textfield and 'border-right' of the last textfield
<ButtonGroup variant="outlined" aria-label="outlined button group">
<TextField label="text" color="secondary" focused />
<TextField label="text" color="secondary" focused />
<TextField label="text" color="secondary" focused />
</ButtonGroup>

Use InputProps to apply class to TextField.
<ButtonGroup variant="outlined" aria-label="outlined button group">
<TextField
label="text"
color="secondary"
focused
InputProps={{
classes: {
notchedOutline: "left"
}
}}
/>
<TextField label="text" color="secondary" focused />
<TextField
label="text"
color="secondary"
focused
InputProps={{
classes: {
notchedOutline: "right"
}
}}
/>
</ButtonGroup>
Create CSS file and then import in your component.
CSS:
.left {
border-left: none !important;
}
.right {
border-right: none !important;
}

Related

Mui text field error exclamation mark not coming properly when error helper text is large

I am using material UI version 5.4 and I have a sign-in form and applied validations on it. Validation is appearing properly but my problem is when I placed a long texted error message the exclamation mark is coming below outlined text field of the MUI material.
Here is the screenshot:
And here is the code:
<Box
component="form"
role="form"
sx={{
"& .MuiFormHelperText-root": { color: "#d32f2f" },
"& .MuiInputLabel-formControl": { paddingTop: "5px" },
}}
>
<Box mb={2}>
<TextField
type="email"
label="Email"
variant="standard"
fullWidth
onChange={(e) => emailHandler(e)}
error={emailError}
helperText={emailError ? emailErrorMessage : ""}
/>
</Box>
<Box mb={2}>
<TextField
margin="dense"
type="password"
label="Password"
variant="standard"
fullWidth
onChange={(e) => passwordHandler(e)}
error={passwordError}
helperText={passwordError ? passwordErrorMessage : ""}
/>
</Box>
<Box>
<span style={{ color: "#d32f2f", fontSize: "12px" }}>{error}</span>
</Box>
<Typography variant="button" color="info" to="/forgot-password" component={Link}>
Forgot Password?
</Typography>
<Box mt={4} mb={1}>
<Button variant="gradient" color="newColor" fullWidth onClick={signInHandler}>
sign in
</Button>
</Box>
<Box mt={3} mb={1} textAlign="center">
<Typography variant="button" color="text">
Don&apos;t have an account?{" "}
<Typography
onClick={() => {
navigate("/sign-up", { replace: true });
}}
style={{ cursor: "pointer" }}
variant="button"
color="info"
fontWeight="medium"
textGradient
>
Sign Up
</Typography>
</Typography>
</Box>
</Box>
How can I solve this styling issue?

How to add sliding animation MUI using CSS

I am facing an issue of adding the slide animation on the question and answer. I want on click of the radio button the slide effect comes and next question comes with Slideup animation.
<Grid item xs={12} sm={8} md={8}>
<Slide direction="up"
in={checked}
appear={true}
mountOnEnter
unmountOnExit
timeout={{ enter: 1000 , exit: checked ? 1 : 900}}
>
<Card variant="outlined" sx={{ bgcolor: "#bea"}} elevation={0}>
<CardContent>
<form onSubmit= {handleSubmit}>
<CardActions>
<Button type="submit" color="warning" variant="outlined" disabled={currentQuestion===0} className={classes.button} onClick={previousQuestion}>
Previous</Button>
</CardActions>
<FormControl component='fieldset' className={classes.formControl}
data-hidden={questions[currentQuestion].number !==
currentQuestion[questions[currentQuestion] .number]} >
<FormLabel component='legend'>
{questions[currentQuestion].question}
</FormLabel>
<FormLabel component='legend'>
{questions[currentQuestion].description}
</FormLabel>
<RadioGroup
aria-label='quiz'
name='quiz'
value={questions[currentQuestion].value}
checked={checked}
onChange={(e)=> handleRadioChange(questions[currentQuestion].number, e)}
sx={{
color: pink[800],
'&.Mui-checked': {
color: blue[600],
},
}}>
{options.map((option) => (
<FormControlLabel
key={option.score}
value={option.score}
control={<Radio sx={{
color: pink[800],
'&.Mui-checked': {
color: blue[600],
},
}}/>}
label={option.label}
/>
))}
</RadioGroup>
</FormControl>
<CardActions>
<Button type="submit" variant="contained" color="primary" className={classes.button} disabled={currentQuestion != 5} onClick={handleSubmit}>
Submit
</Button>
</CardActions>
</form>
</CardContent>
</Card>
</Slide>
This is not working smoothly. So please help. The problem is on click of previous button the value disappeared. The slide effect is not flawless.

Center component vertically and horizontally in 'Antd' library not working

I have a weird issue where I can't center a Row vertically in my screen.
The Card I have is perfectally centered horizontally but not vertically. How can I do that ?
I used the Row component which has align='middle' to align vertically but it isn't working
Here is my implementation:
<Row align='middle' justify='center'>
<Col span={18}>
<Card>
{/* <img className='login-logo' src={logo} alt='logo' /> */}
<Text size='30px' type='BOLD'>
QIFF DASHBOARD
</Text>
<Form name='login' onFinish={formik.handleSubmit}>
<Form.Item>
<Input
id='email'
name='email'
label='Email'
placeholder='Email'
type='email'
autoComplete='new-email'
onBlur={formik.handleBlur}
onChange={formik.handleChange}
value={formik.values.email}
/>
{formik.errors.email ? <Text>{formik.errors.email}</Text> : null}
</Form.Item>
<Form.Item>
<Input
id='password'
name='password'
placeholder='Password'
type='password'
autoComplete='new-password'
onBlur={formik.handleBlur}
onChange={formik.handleChange}
value={formik.values.password}
/>
{formik.errors.password ? <Text>{formik.errors.password}</Text> : null}
</Form.Item>
<div className='submit-button'>
<Button
htmlType='submit'
onClick={formik.handleSubmit}
style={{ width: '100%', backgroundColor: '#f85940', color: 'white' }}
>
Sign in
</Button>
</div>
</Form>
</Card>
</Col>
</Row>
<Row align='middle' justify='center'></Row>
Presumably, the Row tag does not set the attribute display:flex
So justify='center' is invalid
The following solutions can be used:
1、Child element (Need to be centered vertically)
position: relative;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
2、 <Row style="display:flex"></Row>

Text not aligning vertically at the center of select dropdown in material UI core

Please see the image. The text is not aligning at the center of the text box like the other text box fields in the form
Drop down not at the center
Here is my code
<FormControl style={{ width: "80%" }} size="small">
<InputLabel
htmlFor="Implementation Status"
style={{ marginLeft: 10 }}
>
Implementation Status
</InputLabel>
<Select
labelId="Implementation Status"
name="name"
onChange={handleChange("Status")}
defaultValue={values.Status}
variant="outlined"
inputProps={{
id: "Implementation Status",
name: "age"
}}
>
<MenuItem value="Implemented">Implemented</MenuItem>
<MenuItem value="Implementation in Progress">
Implementation in Progress
</MenuItem>
<MenuItem value="Not Implemented">Not Implemented</MenuItem>
</Select>
</FormControl>
<br />
<br />
check this
import React from "react";
import "./styles.css";
import FormControl from "#material-ui/core/FormControl";
import InputLabel from "#material-ui/core/InputLabel";
import Select from "#material-ui/core/Select";
import MenuItem from "#material-ui/core/MenuItem";
export default function App() {
return (
<div className="App">
<FormControl style={{ width: "80%" }} size="small">
<InputLabel id="Implementation-Status" style={{ marginLeft: 10,top:"50%",transform:"translate(0,-50%" }}>
Implementation Status
</InputLabel>
<Select
labelId="Implementation-Status"
name="name"
variant="outlined"
inputProps={{
id: "Implementation Status",
name: "age"
}}
>
<MenuItem value="Implemented">Implemented</MenuItem>
<MenuItem value="Implementation in Progress">
Implementation in Progress
</MenuItem>
<MenuItem value="Not Implemented">Not Implemented</MenuItem>
</Select>
</FormControl>
</div>
);
}

How to increase the width of Material UI dropdown

I am using Material UI dropdown in ReactJs and need to increase the width of the same. Tried to provide properties like style={{minWidth:300}} but its not increasing the width. Below is my code
<form className={classes.root} autoComplete="off">
<TextField
select
variant="outlined"
value={values.age}
onChange={handleChange}
inputProps={{ name: "age", id: "outlined-age-simple" }}
>
<MenuItem value="">
<em>None</em>
</MenuItem>
<MenuItem value={10}>Ten</MenuItem>
<MenuItem value={20}>Twenty</MenuItem>
<MenuItem value={30}>Thirty</MenuItem>
</TextField>
</form>
and here is link of codeSandbox https://codesandbox.io/s/material-demo-t4cvv. How to increase the width?
User property style={{ width: value}} to set width
You can find the updated version of your fiddle here.
example:
<TextField
select
variant="outlined"
value={values.age}
onChange={handleChange}
style={{ width: 400}}
inputProps={{ name: "age", id: "outlined-age-simple" }}
>
<MenuItem value="">
<em>None</em>
</MenuItem>
<MenuItem value={10}>Ten</MenuItem>
<MenuItem value={20}>Twenty</MenuItem>
<MenuItem value={30}>Thirty</MenuItem>
</TextField>
You can add CSS like:
.MuiSelect-root {
min-width: 300px;
}
If you have multiple dropdowns in the same component then you must use this CSS with its parent class.

Resources