Help mixing in dark mode / inverse components into an otherwise light design #4342
-
Hiya! I'm trying to implement the new design for the Twilio Code Exchange site using Paste, and am running into some difficulties reconciling what I can do vs what the design is asking for. The design: ![]() I've been able to replicate the hero section by manually reproducing the Unfortunately, such variants don't exist for Pills/Form Pills which are part of the design so far. Intuitively I've tried wrapping the card headers inside of example code: return (
// Stand in for Card
<Box
as="article"
borderWidth="borderWidth10"
borderColor="colorBorderWeaker"
borderStyle="solid"
borderRadius="borderRadius30"
>
<Theme.Provider theme="twilio-dark">
<Box
backgroundColor="colorBackgroundInverseStrong"
color="colorTextInverse"
paddingY="space50"
paddingX="space70"
margin="space0"
borderTopLeftRadius="borderRadius20"
borderTopRightRadius="borderRadius20"
fontWeight="fontWeightSemibold"
fontSize="fontSize30"
>
<FormPillGroup {...pillState} aria-label="tags">
{productTags.slice(0, 2).map((product) => {
const ProductIcon = Literal.productIcon(product);
return (
<FormPill
{...pillState}
key={product}
onSelect={filterProduct(product)}
selected={filters.products?.includes(product)}
>
<ProductIcon decorative={false} title={`Twilio ${Literal.productName(product)}`} />
{Literal.productName(product)}
</FormPill>
);
})}
{productTags.length > 2 && <FormPill {...pillState}>+ {productTags.length - 2}</FormPill>}
</FormPillGroup>
</Box>
</Theme.Provider>
<Box>
... rest of the card content
</Box>
</Box> Is it not technically sound to mix providers like this, and they all globally affect the CSS of the app? If so, how could we get inverted pills, shy of having to rewrite them ourselves? 😅 Appreciate any guidance! Note: I was able to do this without any visual affects in a separate PR where I'm proving out the idea of an API Reference docs section, because we need inverted badges. Not sure why that was fine but this is causing chaos 😓 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Disclaimer: This is a very experimental bot using OpenAI's GPT-4. The answers may not be correct, a human will review the answer and update it if necessary. Hiya! It sounds like you're trying to achieve a specific design using the Paste Design System for the Twilio Code Exchange site, particularly looking to use inverted styles for Pills/Form Pills that match the rest of your design's aesthetic. From what you've described, it seems you've encountered an issue with trying to use the Unfortunately, based on the provided Paste documentation sections, there isn't a direct mention of support for an However, considering the flexibility and composability that Paste aims to provide, one approach to achieve the desired look for your Pills/Form Pills without needing to rewrite them completely or rely on nested Given the limitations and the information provided, here's a suggestion on how you might proceed without explicit support for an
Unfortunately, without direct support for an For more detailed guidance or to explore if there have been any updates or workarounds since the knowledge cutoff date, I recommend reaching out directly to the Paste Design System team or consulting the latest version of the Paste documentation at https://paste.twilio.design. I also did a search, and I managed to find these other Discussions that might be similar or related to your question. Give them a read to see if they answer your question. If they do, head back here and update this discussion and mark it as answered, pointing others to the related discussion:
|
Beta Was this translation helpful? Give feedback.
-
Hey @stern-shawn ! Can you submit a dependency request for inverse variants of Pills and Badges? https://airtable.com/appwvsQKyJHfnG5Sa/shrvMvL3BG6Zm0f9l For more context on inverse variants vs. themes: It's definitely not recommended to mix themes within an app—it gets pretty wonky like you've noticed hah. "Inverse" variants (and tokens) are ones we've specifically styled and implemented on certain components where they've needed to look the same when a user flips between dark and light modes—usually on navigation bars. Some things that would be helpful to know so we can get this prioritized:
Feel free to tag your designer into this discussion or sign up for office hours too with them https://docs.google.com/spreadsheets/d/10vD91zdwr9hjgDOV3HSGnoC0LgvYw-thmn3X_kvW0xk/edit?gid=664218049#gid=664218049 |
Beta Was this translation helpful? Give feedback.
ooh yeah, that date's coming up soon. The route you're going down with creating custom component with Box + Text and copying the existing Display Pill code is going to be your best bet to ship by then.
I'll keep your dependency request for the inverse Display Pill on our roadmap still, and you can swap to the Paste component when we do release it.
(And for some unsolicited design feedback: imo the lighter pill didn't really read to me as the "main product" at first. It seemed like it was the parent product, and the darker ones were children. Happy to chat more about this too if/when you and @blbelli have an iteration on this planned. We can figure out if there's something in Paste we shou…