μ΄λ¬ν μ λ ₯μ ν μ€νΈ μμμ λ³κ²½νλ λ°©λ²μ λν μ§μΉ¨μ μμ΅λλ€ https://material-ui-next.com/demos/text-fields/
μ΄ μμ μ μννκΈ° μν΄ μΈλΆ CSSλ₯Ό μ¬μ©ν©λκΉ?
λλ λν μ΄κ²μ μλνμ§λ§ TypeScript κ²μ¬λ₯Ό ν΅κ³Όνμ§ λͺ»νμ΅λλ€.
<TextField
inputProps={{ style: { fontFamily: 'Arial', color: 'white'}}}
style={{ flex: 1, margin: '0 20px 0 0', color: 'white'}}
onChange={(e: ChangeEvent<HTMLInputElement>) => changeSearch(e.target.value)}
type="text"
value={reducerState.search}
/>
(50,11): error TS2339: Property 'inputProps' does not exist on type 'IntrinsicAttributes & TextFieldProps & { children?: ReactNode; }'.
μ΄κ²μ μμ ν TypeScript μ ν λ¬Έμ μΌ μ μμ΅λλ€.
λ°©κΈ μΈλΆ CSSλ‘ μννμ΅λλ€.
.something input {
color: white;
}
@QuantumInformation μ루μ μ μ°Ύμμ λ€νμ λλ€. μ¬λλ€μ΄ μ΄λ κ²νλλ‘ κΆμ₯ν©λλ€.
import React from "react";
import PropTypes from "prop-types";
import { withStyles } from "@material-ui/core/styles";
import TextField from "@material-ui/core/TextField";
const styles = {
root: {
background: "black"
},
input: {
color: "white"
}
};
function CustomizedInputs(props) {
const { classes } = props;
return (
<TextField
defaultValue="color"
className={classes.root}
InputProps={{
className: classes.input
}}
/>
);
}
CustomizedInputs.propTypes = {
classes: PropTypes.object.isRequired
};
export default withStyles(styles)(CustomizedInputs);
https://codesandbox.io/s/1370v7y4zj
μ μ ν΄λμ€ μ΄λ¦ ( .MuiInputBase-root
λ° .MuiInputBase-input
)μ λμμΌλ‘ μ§μ ν μλ μμ΅λλ€.
"@material-ui/core"
μμ μλνμ§ μμ
λͺ¨λ μ
λ°μ΄νΈ, @material-ui/core
μ (κ³Ό) ν¨κ» μλνλλ‘ λ§λλ λ°©λ²
@pankajparkar μ΅μ λ²μ μΌλ‘ μμ νκΈ° μν΄ μ΄μ λ΅λ³μ μ λ°μ΄νΈνμ΅λλ€ : https://github.com/mui-org/material-ui/issues/9574#issuecomment -353179532 λμμ΄ λμκΈ°λ₯Ό λ°λλλ€. μλ €μ£ΌμΈμ! λλ https://material-ui.com/demos/text-fields/#customized -inputsμ μ¬μ©μ μ μ λ°λͺ¨κ°
@oliviertassinari κ°μ¬ν©λλ€. μλνκ²νλ €λ©΄ label
μ μ κ±°ν΄μΌνμ΅λλ€.
λ μ΄λΈλ‘ μμ
ν μμλ μ루μ
/ ν΄κ²° λ°©λ²μ΄ μμ΅λκΉ? λ μ΄λΈμ΄ μ€λ²λ μ΄λλ μ΄μ λ₯Ό μ΄ν΄ν©λλ€ ( z-index
λ₯Ό μ μ©νμ¬ λΆλΆμ μΌλ‘ μ λ ¬νμ§λ§ λ€λ₯Έ λ¬Έμ κ° λ°μνμ΅λλ€).
μ¬κΈ°μ λ¬Έμ
λλ¨ν κ°μ¬ν©λλ€
Dang, λ΄ μ²« λλ΅μ΄ μΌλ§λ μΈκΈ°κ° μμλμ§ λͺ°λμ΄
@oliviertassinari κ°μ¬ν©λλ€. μλνκ²νλ €λ©΄
label
μ μ κ±°ν΄μΌνμ΅λλ€.
λ μ΄λΈλ‘ μμ ν μμλ μ루μ / ν΄κ²° λ°©λ²μ΄ μμ΅λκΉ? λ μ΄λΈμ΄ μ€λ²λ μ΄λλ μ΄μ λ₯Ό μ΄ν΄ν©λλ€ (z-index
λ₯Ό μ μ©νμ¬ λΆλΆμ μΌλ‘ μ λ ¬νμ§λ§ λ€λ₯Έ λ¬Έμ κ° λ°μνμ΅λλ€).μ¬κΈ°μ λ¬Έμ
λλ λκ°μ κ²μ΄ νμν©λλ€!
κ°μ₯ μ μ©ν λκΈ
@QuantumInformation μ루μ μ μ°Ύμμ λ€νμ λλ€. μ¬λλ€μ΄ μ΄λ κ²νλλ‘ κΆμ₯ν©λλ€.
https://codesandbox.io/s/1370v7y4zj
μ μ ν΄λμ€ μ΄λ¦ (
.MuiInputBase-root
λ°.MuiInputBase-input
)μ λμμΌλ‘ μ§μ ν μλ μμ΅λλ€.