我是样式组件的新手。我想通过将道具传递给组件来设置输入宽度。预期输出应该是:
<Input width=30px> or <Input width=100%>
这是我的组件:
import styled from "styled-components"
const UIInput = styled.input`
padding: 5px;
width: ${props => props.width ? width : 'auto'}
`
export default UIInput