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
Using badge is currently awkward since you need to add the theme attribute to arbitrary components with the following hack:
badge
theme
<span {...{ theme: 'badge success' }}>Confirmed</span>
The hack, in this case, is required because "theme" is not a recognized property of a <span>.
<span>
Provide a <Badge> wrapper in the component set, which applies the required "theme" attribute internally.
<Badge>
<Badge> <span>Pending</span> </Badge> <Badge theme="success"> <Icon aria-label="Confirmed" icon="vaadin:check" style={{ padding: 'var(--lumo-space-xs)' }} title="Confirmed" /> </Badge>
Prototype of the <Badge> wrapper:
function Badge({ children, theme }: { children: React.ReactNode; theme?: string }) { return React.Children.map(children, (child) => { if (React.isValidElement(child)) { return React.cloneElement(child, { ...{ theme: `badge${theme ? ` ${theme}` : ''}` } }); } return child; }); }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Description
Using
badge
is currently awkward since you need to add thetheme
attribute to arbitrary components with the following hack:The hack, in this case, is required because "theme" is not a recognized property of a
<span>
.Provide a
<Badge>
wrapper in the component set, which applies the required "theme" attribute internally.Usage example
Prototype of the
<Badge>
wrapper:The text was updated successfully, but these errors were encountered: