We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
<Button text={0} />
Empty button rendered
Button with 0 as text should be rendered
I suppose you're checking if the text prop is truthy, but 0 won't be truthy.
The text was updated successfully, but these errors were encountered:
😂 love it
Sorry, something went wrong.
@giladgray any preference on the implementation? could attempt to convert the value to a string something like
const textValue = text != null ? String(text) : undefined;
This would support values like <Button text={false} /> (not sure if this is a good thing) or do you think we just make a special case for 0?
<Button text={false} />
0
@badams definitely do not coerce the type, just check that it's defined. text={false} should render nothing, like any other JSX usage.
text={false}
this is the line to change: https://github.com/palantir/blueprint/blob/develop/packages/core/src/components/button/abstractButton.tsx#L152.
and please add a unit test.
No branches or pull requests
Environment
Steps to reproduce
<Button text={0} />
Actual behavior
Empty button rendered
Expected behavior
Button with 0 as text should be rendered
Possible solution
I suppose you're checking if the text prop is truthy, but 0 won't be truthy.
The text was updated successfully, but these errors were encountered: