[v12] feat(ui-buttons): add v2 button components with new icon system and theming#2427
[v12] feat(ui-buttons): add v2 button components with new icon system and theming#2427
Conversation
|
1e871a2 to
d3f8bfd
Compare
62791a3 to
199a92f
Compare
adamlobler
left a comment
There was a problem hiding this comment.
I left some minor comments, if something is not clear we can talk about them in a meeting
| <View display="block"> | ||
| <Button size="condensedSmall" margin="small">Condensed Small</Button> | ||
| <Button size="condensedMedium" margin="small">Condensed Medium</Button> | ||
| <Button size="small" margin="small">Small</Button> |
There was a problem hiding this comment.
I think this line shouldn't be here
There was a problem hiding this comment.
i added the small size here for comparison, not strictly necessary
| paddingTop: componentTheme.paddingVertical, | ||
| paddingBottom: componentTheme.paddingVertical, |
There was a problem hiding this comment.
We don't need these, the height tokens are enough. We can delete it because this way the small size variant is taller (36pxs) than the smallHeight token that is 32px, and this way it doesn't follow the design.
There was a problem hiding this comment.
this was removed and added back by @hajnaldo because we realized that without padding the wrapped multiline buttons would break. however the small variant being 36 instead of 32 is a bug and i'll check it
There was a problem hiding this comment.
yes, it looks like this padding is too large for the small varirant. i guess it should be either reduced or an other one introduced for small icons
| <Button color="ai-primary" renderIcon={SparklesInstUIIcon} margin="small">AI Primary</Button> | ||
| <Button color="ai-secondary" renderIcon={SparklesInstUIIcon} margin="small">AI Secondary</Button> | ||
| <IconButton color="ai-primary" screenReaderLabel="AI button" margin="small"><SparklesInstUIIcon/></IconButton> | ||
| <IconButton shape='circle' color="ai-secondary" screenReaderLabel="AI button" margin="small"><SparklesInstUIIcon/></IconButton> | ||
| <IconButton shape='circle' color="ai-primary" screenReaderLabel="AI button" margin="small"><SparklesInstUIIcon/></IconButton> | ||
| <IconButton color="ai-secondary" screenReaderLabel="AI button" margin="small"><SparklesInstUIIcon/></IconButton> |
There was a problem hiding this comment.
In design we have a custom icon for the ai features, we should use this instead. I'm not sure if its available in code now or not.

There was a problem hiding this comment.
that one is work in progress, i can replace once that's merged into v12
There was a problem hiding this comment.
Peti said that its available on this branch: https://github.com/instructure/instructure-ui/tree/INSTUI-4892-tidy-up-the-icons-gallery
There was a problem hiding this comment.
yes, and as far as i know it will be merged in the coming days, so i can rebase and use it
| Use backgroundless buttons for interfaces on dark backgrounds or when there is a need to deemphasize the button from another primary action on the page. Be sure to use border/text colors that meet the proper contrast ratios with whatever background they are placed on. | ||
|
|
||
| ```js | ||
| --- | ||
| type: example | ||
| --- | ||
| <View display="block"> | ||
| <View display="inline-block" background="primary"> | ||
| <Button renderIcon={PlusInstUIIcon} withBackground={false} color="primary" margin="small">Click here</Button> | ||
| </View> | ||
| </View> | ||
| ``` | ||
|
|
There was a problem hiding this comment.
I wouldn't advertise this capability, everyone should use the color prop instead to "deemphasize" the button. I tried to make a proper View background + Button (without bg) combo but I can't create even one that doesn't have a11y issues on light or dark mode, so I would delete this section.
There was a problem hiding this comment.
I realised that this is the only option now to have a tertiary button, so I would show this:
<View display="block">
<Button renderIcon={PlusInstUIIcon} withBackground={false} color="secondary" margin="small">Click here</Button>
</View>
With this description removing some words:
Use backgroundless buttons when there is a need to deemphasize the button. Be sure to use border/text colors that meet the proper contrast ratios with whatever background they are placed on.
| position: 'absolute', | ||
| inset: '0', | ||
| borderRadius: 'inherit', | ||
| padding: componentTheme.borderWidth, |
There was a problem hiding this comment.
Because of the padding these outline variants are always bigger than the others with the size of the borderWidth. Maybe we should override the general minHeight here with minHeight=heightToken-borderWidth
There was a problem hiding this comment.
i will look into this
There was a problem hiding this comment.
i guess this is the same issue as the small variant with the padding
|
…heming Create v2 versions of all 6 button components (BaseButton, Button, CloseButton, CondensedButton, IconButton, ToggleButton) using the new Lucide icon system and NewComponentTypes theme system. Add exports/b.ts for v2 exports and update ./v11_7 and ./latest package entry points to resolve to v2.
Remove v1 test files (only latest version needs tests) and simplify backgroundless button documentation section in v2 Button README.
64899b5 to
a5b305d
Compare



INSTUI-4787
Summary
Migrates Button, CondensedButton, and IconButton to the new v12 centralized theme system.
theme.tsfiles from Button, CondensedButton, and IconButton (they re-exported BaseButton's theme) — theming is now handled centrally viawithStyle(null, 'BaseButton')withStyleReworktowithStyleand from legacygenerateComponentThemeto the new token-based approach (NewComponentTypes/SharedTokens)opacity: 0.5)condensedSmallandcondensedMediumrenderIconWithPropswith proper size mapping per button size::beforepseudo-element mask technique instead of relying on background gradient as borderdisplay: blocktodisplay: flexwithalignItems: centerfor proper vertical alignmentdarken/lightencolor utils with dedicated theme tokens for hover/active statesTest plan
condensedSmall,condensedMedium) render at the correct compact heights