Passed Props
You can pass props to the styled component, similar to Vue components. For instance, you can pass a placeholder to the styled input.
Basic
And you can also use props in the styles. For example, you can use the borderColor
prop to change the border color of the input.
NOTE
You need define the props in the styled
function if you want to use them directly in the style. Because Vue components require explicit props declaration so that Vue knows what external props passed to the component should be treated as fallthrough attributes.(see Props Declaration)
New way to pass props
From v1.7.0
, you can use the props
option to pass props to the styled component.