transitent props
const StyledButton = styled.button`
background-color: ${(props) => (props.isActive ? "blue" : "gray")};
`;
<StyledButton isActive={true}>Click me</StyledButton>;Warning: Received `true` for a non-boolean attribute `isActive`.
If you want to write it to the DOM, pass a string instead: isActive="true" or isActive={value.toString()}.const StyledButton = styled.button`
background-color: ${(props) => (props.$isActive ? "blue" : "gray")};
`;
<StyledButton $isActive={true}>Click me</StyledButton>;Last updated