BraidTestProvider: Provide scrollIntoView
stub function for jsdom (#1590)
Fixes an issue where scrollIntoView
is not defined in jsdom, causing tests to fail with the following error:
Error: Uncaught [TypeError: highlightedItem?.scrollIntoView is not a function]
Autosuggest: Update suggestion group heading design (#1581)
Updating the design of the suggestion group headings, moving from formAccent
to secondary
tone, from all caps to provided casing, and from xsmall
to small
size.
Text, Heading: Ensure maxLines
truncates correctly when used as the direct child of a flex container. (#1580)
Validate accessible field labels in development (#1591)
Introduce development-time validation for the label
prop on form fields to guard against blank values and guide towards the alternative labelling options that are available.
This validation helps ensure that all fields are accessible to screen readers and other assistive technologies.
Spread: Apply content width to children (#1583)
Align the behaviour of children in Spread
to be the same as Inline
children.
This makes their behaviour more predicatable when spreading full width elements, while also ensuring child elements are not stretched vertically.
Icons: Support rendering inline as child of a flex container (#1585)
Stack, Tiles: Deprecate dividers
prop (#1574)
In preparation for migrating Braid layout components to use CSS gap, the dividers
prop has been deprecated on Stack
and Tiles
.
Consumers are encouraged to migrate now in advance of its removal in v33.
See migration guide for details on how to migrate off the dividers
prop.
Autosuggest: Improve handling of suggestionHighlight
prop when set to remaining
(#1572)
Fixes a bug in Autosuggest
when using suggestionHighlight
prop set to remaining
.
If the input contained multiple words, the highlighted portion would be appended to the end of matching suggestions.
Divider: Ensure full width in flex container (#1574)
Ensures the Divider
component remains full width when used as a flex child inside a flex container.
RadioItem: Improve checked
visual affordance when disabled
(#1564)
Improve the visual affordance of the checked
state when disabled
across all themes and colour modes.
MenuRenderer, OverflowMenu: Limit the menu height (#1567)
Limit the menu to show a maximum of around 10 items before scrolling (a little less so it's evident there is more to scroll to).
TextLink: Default to weak inside secondary tone (#1561)
Align the secondary
tone with other non-neutral text tones, making the foreground color of links inherit the tone of the wrapping Text
component.
EXAMPLE USAGE:
In the following example the TextLink
will now follow the secondary
tone from the wrapping Text
component:
<Text tone="secondary"> <TextLink href="#">Link</TextLink> </Text>
Previously this would have retained the default link colour from the theme.
Standardise disabled
& critical
state across form fields (#1564)
Improves the consistency of form fields when combining both disabled
and critical
tone, which includes:
critical
bordersmessage
and not reserving space for it unless explicitly providing the reserveMessageSpace
prop.Column: Add support for hide above/below breakpoint (#1553)
Introduce new hideAbove
and hideBelow
props on column for responsively hiding columns across breakpoint.
These props can be used either separately or in combination to optimise content display across different screen sizes.
EXAMPLE USAGE:
<Columns space="small"> <Column> <Placeholder height={60} label="Always visible" /> </Column> <Column hideBelow="tablet"> <Placeholder height={60} label="Tablet and above" /> </Column> <Column hideAbove="mobile"> <Placeholder height={60} label="Mobile Only" /> </Column> </Columns>
Badge: Enable usage inside typographic components (#1547)
A Badge
can now be nested inside typographic components, e.g. Text
and Heading
, as an inline element alongside text.
Previously a Badge
had to be aligned against text using an Inline
component, which would result in the Badge
dropping below the text when the copy wrapped.
EXAMPLE USAGE:
<Text> Lorem ipsum velit in <Badge>amet</Badge>. </Text>
Tabs: Add size
support (#1550)
Introduces the ability to customise the size
of the Tab
components in the tab list.
Available sizes are standard
(default) and small
.
EXAMPLE USAGE:
<Tabs size="small"> <Tab>First tab</Tab> <Tab>Second tab</Tab> <Tab>Third tab</Tab> </Tabs>
Spread: Add new layout component (#1554)
Introduce a new layout component, Spread
, used to justify content with both an equally distributed and a specified minimum amount of space in between each child.
EXAMPLE USAGE:
The Spread
component works horizontally by default:
<Spread space="small" alignY="center"> <Heading level="4">Heading</Heading> <OverflowMenu label="Options"> <MenuItem>First</MenuItem> <MenuItem>Second</MenuItem> </OverflowMenu> </Spread>
But can be switched to vertical
via the direction
prop:
<Spread space="large" direction="vertical"> <Stack space="small"> <Heading level="4">Heading</Heading> <Text>Text</Text> </Stack> <Text size="small" tone="secondary"> Date </Text> </Spread>
Move badge
slot inside label (#1547)
Relocate the badge
slot inside the label
slot enabling the Badge
to sit alongside the last word in wrapping lines of text.
Improve internal form field spacing (#1541)
Refined the spacing between internal elements of form fields to align with the latest spacing guidelines.
This change impacts the Stack
spacing between label
and description
, the form field itself and the message
slots.
Autosuggest: Add suggestionHighlight
prop (#1536)
Introduces the suggestionHighlight
prop, which uses the input value to automatically highlight either the matching
or remaining
portion of each suggestion.
EXAMPLE USAGE:
<Autosuggest suggestionHighlight="matching">
Refine the Checkbox, Radio, Toggle & MenuItemCheckbox size (#1541)
Refines the size of the inline field elements including the RadioItem
, Checkbox
, Toggle
and MenuItemCheckbox
components.
Primarily impacts consumers of the seekJobs
theme, seeing a reduction across all sizes.
Ensure no space above field with undefined
label (#1541)
Fixes an issue where passing undefined
as the label
to a form field would result in an unwanted space above the field.
Badge: Ensure label follows correct tone (#1544)
Ensure that the foreground text of a Badge
always follows the correct tone for the background colour.
Fixes a bug where using a Badge
in a List
that overrides the default tone would result in the Badge
text following the List
tone instead of the Badge
tone.
Fix warning in React 18.3.0 when using useToast. (#1534)
MonthPicker: Reduce space between month and year fields (#1541)
Reducing the space between month and year fields to improve correlation between the two fields within the greater context of a form.
Toggle: Add togglePosition
prop (#1509)
Introduces the togglePosition
prop, enabling the toggle to either be leading
or trailing
its label text.
EXAMPLE USAGE:
<Toggle togglePosition="trailing" label="Label" />
Toggle: Add bleedY
prop (#1519)
Introduces the bleedY
prop, enabling vertical bleed for the Toggle
component. This removes excess vertical space created by the Toggle
input.
EXAMPLE USAGE:
<Toggle label="Label" bleedY />
MIGRATION GUIDE:
Vertical bleed will become standard for the Toggle
component in a future version. Please use the bleedY
prop with a value of true
and update your layout accordingly.
Tag: Introduce "addable" support (#1521)
Tag actions have been extended to now support being “added”.
A Tag
will include a small add icon button when both an onAdd
handler and addLabel
prop are provided.
EXAMPLE USAGE:
<Tag onAdd={() => {...}} addLabel="Add Tag" />
seekJobs: Use Tahoma for Thai fallback font (#1527)
Currently in the seekJobs
theme, the fallback font for the Thai character set resolves to the default system font which differs by operating system.
By choosing a deterministic fallback that is available across operating systems, we can use Capsize to improve the alignment with the SEEK Sans web font, and reduce Cumulative Layout Shift for experiences that use Thai.
Additionally, adding sans-serif
as an ultimate fallback in the event that we ever fall all the way through the stack on an obscure operating system.
Tag: Add missing click event parameter to onClear
prop type (#1516)
Toggle: Improve label text vertical alignment at small
size (#1518)
Toggle: Remove tick icon & fix antialias haze when selected (#1525)
Simplying the selected state design by removing the tick icon from the toggle thumb.
Also fixes the antialias haze that appears around the thumb when selected.
Move secondary ButtonIcon tone to icons (#1512)
Following the deprecation of the secondary
tone of ButtonIcon
, this updates all internal usages to apply the secondary
tone directly to the icon.
PageBlock: Add small
and full
width options (#1504)
Add small
to available width
options of PageBlock
to support narrower max width for page content.
Also introducing full
as a width
option to enable full width content, while still maintaining consistent screen gutters.
EXAMPLE USAGE:
<PageBlock width="small">...</PageBlock>
ContentBlock: Add support for left alignment (#1507)
Introduces horizontal alignment support for ContentBlock
, enabling content to be constrained to a max width and aligned to the left.
Useful inside of larger PageBlock
or ContentBlock
elements when constraining the content for readability or length of form fields.
EXAMPLE USAGE:
<ContentBlock align="left">...</ContentBlock>
ButtonIcon: Add formAccent
tone (#1508)
Introduces support for the formAccent
tone on ButtonIcon
.
The new tone sits alongside the existing neutral
tone, while the secondary
tone is now deprecated and will be removed in a future version (see Migration Guide below).
EXAMPLE USAGE:
<ButtonIcon tone="formAccent" icon={<IconAdd />} />
MIGRATION GUIDE:
For consumers of the now deprecated secondary
tone, you can pro-actively migrate away from it by moving the tone
to the icon itself:
<ButtonIcon - tone="secondary" - icon={<IconAdd />} + icon={<IconAdd tone="secondary" />}
dedent
: ^1.5.1
clsx
: ^2.1.1
is-mobile
: ^4.0.0
IconPromote: Update semantic icon from sparkles to a megaphone (#1500)
With the introduction of IconAI
recently adopting the sparkles artwork (aligning with the industry trend), the IconPromote
semantic is now updated to use a megaphone instead of sparkles.
This change will run through all semantic usages, for example Alert
, Notice
, etc.
ButtonIcon: Add small
size (#1496)
Introduce a new small
size for ButtonIcon
component.
This size sits alongside the existing standard
and large
sizes.
EXAMPLE USAGE:
<ButtonIcon size="small" icon={<IconEdit />} label="Small size" />
Add exit animation to Dialog
which mirrors the existing entrance animation. (#1489)
Tag: Add small
size (#1497)
Introduce a new small
size for Tag
component.
This size sits alongside the existing standard
size, which is the default.
EXAMPLE USAGE:
<Tag size="small">Tag</Tag>
Ensure all paths through AutoSuggest
state updates are handled. (#1486)
Fix minor bug which prevented the Drawer
exit animation from occurring. (#1489)
Update Capsize dependencies (#1484)
Adopt small
sized ButtonIcon
for field actions (#1496)
Switch over to small
(previously standard
) sized ButtonIcon
for field actions such as clear field, or toggle password visibility.
Update Crackle CLI dependency (#1480)
Improve virtual touch target positioning for narrow elements (#1493)
To maintain accessibility for smaller interactive elements, Braid uses a virtual touch target to maintain the minimum hit area. This change ensures that the virtual element is always centered to the visual target, in particular when the width of the visual target is narrower than the minimum hit area.
Update semantic icon assets. (#1481)
IconCritical
: Move from circle to diamond outline. Increase the visual distinction from IconInfo
.
IconLanguage
: Move from globe to characters. Better represents the concept of language. Previous asset available as IconGlobe
.
MIGRATION GUIDE
As the above are updates to semantics icons, consumers are unaffected if their usage follows the icon's semantic intent. For those choosing the icon based on its visual appearance, please review the usage and consider decoupling from the semantic system icon for safer upgrades.
Add new icons to the library (#1481)
Text, Heading: Fix maxLines
cropping of decending characters (#1451)
Fixes a bug when using -webkit-box, where the descender on the last line of text could be cropped based on the combination of line height and font size.
Tab: Remove cropping of the icon slot (#1447)
Previously the icon
slot on a Tab
was cropped on the left to improve alignment with the active tab indicator.
For most icons in a Tab
, this was subtle polish, but for others it had the undesirable side effect of clipping the side of the icon.
Removing the cropping until we have a better solution for trimming whitespace around icons.
Badge: Allow Badge
to take arrays of values (#1443)
Previously, Badge
only accepted a string
as children, to prevent the use of other components inside a Badge
.
However, when a variable is included with text inside the Badge
, the children property is interpreted as an array. This prevents a very reasonable use case from being allowed:
<Badge>{jobs.length} Jobs</Badge> // Error: Type '{ children: string[]; }' is not assignable to type 'BadgeProps'.
This change allows Badge
to accept a string, number, or array thereof.
Fix circular dependencies (#1444)
IconSocialX: Add new icon (#1438)
Add the new IconSocialX
component to the suite of social icons, enabling teams to migrate across from IconSocialTwitter
which has now been marked as deprecated.
EXAMPLE USAGE:
<IconSocialX />
MIGRATION GUIDE:
Teams should migrate from IconSocialTwitter
to IconSocialX
at their earliest convenience. The IconSocialTwitter
component will be removed in a future release.
-<IconSocialTwitter /> +<IconSocialX />
react-focus-lock
to avoid build warnings in Rollup and Vite (#1433)Rating: Add weight
support (#1430)
Provide a weight
prop to customise the weight of the text rating alongside the stars.
EXAMPLE USAGE:
<Rating rating={3} weight="strong" />
Autosuggest: Fix aria-label and aria-labelledby features (#1420)
Fixes an issue where the aria-label
and aria-labelledby
props provided by a consumer were being overidden internally by the Autosuggest
component.
TooltipRenderer: Fix useLayoutEffect
warnings during SSR (#1407)
Tabs: Improve positioning of the active underline (#1407)
Fixes a bug where the reset module mistakenly included all the tokens for all the themes. (#1405)
Additionally, this includes significant compilation improvements to ensure that only styles for the components being used are included — speeding up build times and reducing the overall CSS bundle size.
Add optional tooltipPlacement
prop to ButtonIcon
(#1390)
The tooltipPlacement
prop allows you to specify the placement of the tooltip to either top
or bottom
.
The default value is top
.
EXAMPLE USAGE:
<ButtonIcon tooltipPlacement="bottom" />
seekJobs: Update formAccent
colour (#1387)
The formAccent
tone, used through our form fields and buttons, is being updated to a derivative of the SEEK brand blue.
As this update only relates to the seekJobs
theme, consumers of other themes will not be affected.
The Braid Provider contains some code to check that it's running in a browser context (otherwise a BraidTestProvider should be used). (#1382)
Part of this check was looking to see if there was a navigator
object, which was not available in Node.
If there were, it would check the userAgent
to determine if it was inside jsdom.
Node 21 has a navigator
object, but it doesn't have a userAgent
property, so this check was failing (cannot read property 'indexOf' of undefined).
The "are we in JSDom" check in the BraidProvider has now been reworked slightly to account for the potentially existing but empty navigator
object.
TextLink, TextLinkButton: Ensure consistent underline thickness on weak links (#1380)
A subtle bug affecting weak links was resulting in a change in underline thickness on hover. This bug has been fixed such that weak links now always have the same underline thickness regardless of hover state.
TooltipRenderer: Re-evaluate position when trigger
or children
changes (#1374)
Fixes an issue where the tooltip would not re-evaluate its position when the trigger
or children
prop changed while the tooltip was already open.
When animating an SVG circle, it seems that the width changes slightly, which on Loader was causing the right-most one to push off the boundaries of the SVG View Box. (#1370)
This has been fixed so clipping should no longer occur.
Button, ButtonLink: Default to neutral ghost in non-legacy themes (#1363)
By default, a button now has a neutral
tone and uses the ghost
variant, allowing the visual prominence to be increased or decreased as required, enabling colour to be applied as accents and with purpose, rather than by default.
<Button /> // => tone="neutral" & variant="ghost"
To compliment this, when a tone
is purposefully applied, the default variant becomes solid
to maximise its impact — allowing the visual prominence to be reduced as needed.
<Button tone="brandAccent" /> // => tone="brandAccent" & variant="solid"
apac
and seekBusiness
consumersGiven the fundamental change in approach to colour and usage of such a core component, this change has been isolated to newer themes and does not impact apac
and seekBusiness
consumers.
These themes will continue to have a tone of formAccent
and a solid
variant by default, allowing consumers to adopt this new approach as part of the design uplift when migrating to an updated theme, e.g. seekJobs
.
Button, ButtonLink: Provide formAccent
as the name for undefined tone (#1359)
Formalise the name of the undefined
tone as formAccent
, making it more discoverable as an accent available for increased prominence.
Note: Consumers should only apply this tone where an action should be emphasized explicitly. The undefined
value is still valid for buttons that should follow the default button style of the theme.
EXAMPLE USAGE:
<Button tone="formAccent">...</Button>
seekJobs: Change link colour to neutral (#1347)
Changing the foregroundColor
token for link
on the seekJobs
theme to align with neutral text.
Our different approach to using colour has seen links dialled back to compete less with other messaging and CTAs.
This affects the following usages across the system:
vars.foregroundColor.link
Text
(using tone="link"
)TextLink
and (TextLinkButton
)TextLink, TextLinkButton: Underline regular links in non-legacy themes (#1347)
To improve affordance beyond primarily being colour, a TextLink
(and TextLinkButton
) will now always be underlined, in line with best practice accessibility guidelines.
Given this has not been the case previously, this decision has been applied to non-legacy themes only, as such only affecting consumers of seekJobs
, docs
and wireframe
.
TextLink, TextLinkButton: Apply themed focus outline (#1347)
Apply a focus outline using the relevant focus attributes from the theme, bringing TextLink
(and TextLinkButton
) into line with the focus treatment applied to rest of the system.
TextLink, TextLinkButton: Reduce weak
links to regular
font weight (#1347)
The font weight of a weak
link is now reduced to regular
weight, reducing the link's visual prominence in addition to following the neutral text colour.
docs: Lighten soft background tokens (#1347)
Lighten the brandAccentSoft
and formAccentSoft
background tokens for the docs
theme.
Dialog, Drawer: Adapt max height to available viewport space (#1352)
Make use of the new dynamic viewport units for applying a max height to modal elements such as Dialog
and Drawer
. These new units take into account dynamic browser toolbars that expand and contract as the user scrolls, ensuring the browser interface never obscures the web site content.
Fix also incorporates fallback for older browsers to use regular viewport units.
Drawer: Prevent close button protruding in left position (#1351)
Fixes an issue where the close button could protrude from a Drawer
.
This was only visible when setting position
to left
and between a small range of screen widths — above 660px (small
content width) and below 768px (tablet
breakpoint).
RadioGroup: Ensure reserveMessageSpace
prevents layout shift correctly (#1349)
Consider the reserveMessageSpace
prop as well as message
when conditionally applying internal padding between radio list and field message.
Page: Add component (#1343)
The new Page
component establishes a consistent page-level layout by managing the relationship between the footer and the main content.
By default, for pages with limited content the footer
will at a minimum be placed at the bottom of the screen, pushed beyond as the page content grows.
For pages with dynamic content, it is recommended to place the footer out of view by setting the footerPosition
prop to belowFold
to prevent the footer from popping in and out of view when the page content changes, e.g. toggling between a loading indicator and content.
EXAMPLE USAGE:
<Page footer={<Footer />}> <Header /> {/* page content... */} </Page>
TabPanel: Align focus outline radius to scale (#1345)
Increase the radius of the focus outline to better align to the scale. A TabPanel
is typically a "large" element containing entire sections of UI, so using the large
radius to better align to the radius scale.
apac, seekBusiness: Increase medium
font weight (#1331)
The unicode range of Thai characters is not satisfied by the preferred fonts specified for the apac
theme, resulting in these characters falling through and being rendered by sans-serif
— which applies a platform-specific font.
These system fonts do not have support for the semi-bold weight chosen for medium
, resulting in the visual weight of medium
text being rounded down to regular
— providing no differentiation relative to other text in the UI.
In addition, due to both Helvetica
and Arial
not having a medium
weight, these fallbacks also have the same problem, even for Latin characters.
By increasing the value of medium
, it will now round to strong
when the rendered font cannot satisfy medium
— preventing the loss of hierarchy.
This only affects apac-based themes, namely apac
and seekBusiness
.
Drawer, Dialog: Increase gutter around close button (#1328)
Fix for a regression where the gutter around the close button was reduced — resulting in visually clashing with the content when scrolling.
seekJobs: Update visited link colour tokens (#1323)
Darken the visited link colour tokens within the seekjobs
theme.
IconEnlarge: Add new component (#1320)
EXAMPLE USAGE:
<IconEnlarge />
The active
prop can be used to toggle the icon into the "reduce" state:
<IconEnlarge active={true} />
Drawer, Dialog: Support validation blocking closure of modal (#1318)
To prevent a Dialog
or Drawer
from closing, e.g. due to validation, the onClose
function can now return false.
EXAMPLE USAGE:
<Drawer open={open} onClose={() => { const valid = runValidation(); if (!valid) { return false; } setOpen(false); }} />
TooltipRenderer: Fix arrow overlapping tooltip corner radius (#1316)
Fix for an edge case where the arrow on a small tooltip could the overlap the corner radius of the tooltip.
Drawer: Darken backdrop in dark mode (#1316)
Increase the weight of the backdrop in dark mode to ensure the content is suffiently obscured.
Drawer: Fix entrance animation from left
position (#1316)
Apply the entrance animation correctly for a Drawer
using the left
position.
Also reduced the horizontal overshoot for the transition for a smoother feel.
Drawer: Increase space between title
and description
on tablet (#1316)
Drawer: Align horizontal gutters with PageBlock (#1316)
Given a Drawer
is full width on a mobile device, applying the same horizontal gutter rules as PageBlock
makes sense.
This ensures content on a mobile will have the same available space whether its in the page, or inside a Drawer
.
PageBlock: Add new component (#1307)
Provides a top-level page container, constraining the content width (using ContentBlock
) while establishing common screen gutters on smaller devices.
EXAMPLE USAGE:
<PageBlock width="large">...</PageBlock>
Button, TextLinkButton: Add aria-label
support (#1304)
Provide support for aria-label
, enabling additional context to be given to assistive technologies where context is typically visual.
EXAMPLE USAGE:
<Button aria-label="Save job">Save</Button>
Hide field borders in dark containers (#1294)
Reduce visual noise when a form field is displayed in a dark container by hiding the default border. As fields are light on light backgrounds, the border is used to delineate its bounds against the container, which is not relevant in a dark container.
Add seekJobs
theme (#1281)
The seekJobs
theme encapsulates the system changes necessary to apply and deliver the updated visual design language for SEEK Jobs.
Through the development of this theme, we have been able improve the fidelity of the various scales in our tokens, while also ensuring that the tokens themselves are consumed and applied more consistently throughout the system itself.
EXAMPLE USAGE:
import seekJobs from 'braid-design-system/themes/seekJobs'; <BraidProvider theme={seekJobs}>...</BraidProvider>;
MIGRATION
Consumers of the apac
theme are not recommended to migrate independently. The seekJobs
theme represents an uplifted visual identity that is part of a wider visual uplift.
Instead, we’ll be guiding the initial teams through a staged migration in coordination with the centralised team process.
There are some differences in how certain concepts are applied, whether it's the space scale, or Card
usage, etc., and we will be documenting these in due course.
If you would like to talk about migrating, please reach out to us in our #braid-support channel on slack.
Text, Heading: Only show truncate deprecation message when true (#1289)
Only show the truncate deprecation message when truncate
is provided and set to true
TextLink, TextLinkButton: Improve underline position for wrapping text (#1290)
Refine the underline position to be consistent across the whole typographic hierarchy, ensuring it does not interfere with wrapping lines of text.
Text, Heading: Add maxLines
support (#1286)
Provide support for limiting the number of lines shown by a Text
or Heading
component.
EXAMPLE USAGE:
<Text maxLines={3}>...</Text>
MIGRATION:
With the addition of this feature, the truncate
prop is now deprecated and will be removed in a future release.
Existing consumers should start migrating as below:
<Text - truncate + maxLines={1} />
Card: Add full height support (#1285)
Provide support for making a Card
use all available vertical space.
This is useful when laying out rows of Card
elements and having them all be equal height.
EXAMPLE USAGE:
<Card height="full">...</Card>
TextLink, TextLinkButton: Update underline design (#1288)
Uplift the design of the the text underline used on TextLink
and TextLinkButton
components.
Column: Support full height content (#1285)
Provide support for full height content by growing all Column
elements to be uniform in height.
This will have no effect on the content itself, but enables consumers to create designs of uniform content, such as rows of Card
elements.
RadioItem, Checkbox: Fix stacking context behaviour (#1284)
A RadioItem
and Checkbox
previously created a new stacking context with an elevated z-index
applied on hover, resulting in their labels overlaying other elements in an unpredictable ways — most noticable when toggling nested content.
For example, toggling nested content containing an Autosuggest
, would see the list of suggestions list would be overlayed by the next RadioItem
on hover.
To fix this, the z-index
is no longer elevated on hover, and additionally the nested content container applies an elevated index when the field is checked.
Textarea: Adjust highlightRange
background to support different line heights (#1279)
Remove the vertical padding on the highlight element to prevent the background colour overlapping the wavy underline in themes with tighter line heights.
MenuItemCheckbox: Align checkbox size with a small
Checkbox (#1276)
Align the size of a MenuItemCheckbox
with a small
sized Checkbox
.
Checkbox, RadioItem: Fix alignment with updated Badge layout (#1280)
Improve layout to work with updated Badge layout which is no longer driven by line height.
MonthPicker: Reduce space between fields (#1277)
Reduce the space between the month and year fields.
Box, atoms: Add borderBrandAccent
variants to available boxShadows (#1274)
Add borderBrandAccent
and borderBrandAccentLight
to the available boxShadows, combining the brandAccent
and brandAccentLight
border colours with the standard
border width token.
Previously, brandAccent
was only available with the large
border width.
EXAMPLE USAGE:
<Box boxShadow="borderBrandAccent" />; { /* or */ } <Box boxShadow="borderBrandAccentLight" />;
import { atoms } from 'braid-design-system/css'; atoms({ boxShadow: 'borderBrandAccent' }); atoms({ boxShadow: 'borderBrandAccentLight' });
useToast: Design uplift with increased page contrast (#1269)
As a means to increase constrast against page content, the design has been updated to be presented on inverted backgrounds based on the color mode.
The design has also be refined to remove the sidebar/keyline (consistent with Alert
), while also applying the tone
to the provided message
.
Textarea: Add support for disabling built-in spell checker (#1272)
Provide support for disabling the built-in browser spell checker using the native HTML attribute spellCheck
.
When highlighting ranges you may choose to turn spell check off to prevent colliding highlights. This can be done be setting spellCheck
to false
.
EXAMPLE USAGE:
<Textarea spellCheck={false} />
Add support for caution
tone to form fields (#1271)
Provide support for applying a caution
tone to form fields.
Specifying this tone
will show the IconCaution
alongside the provided message
.
EXAMPLE USAGE:
<TextField tone="caution" message="Caution message" />
Textarea: Add support for caution
highlightRanges (#1272)
Providing a tone
of caution
along with a set of highlightRanges
will now apply the caution
tone to the text being highlighted.
To complement this feature, the design has been uplifted to work consistently across both the critical
and caution
tones.
EXAMPLE USAGE:
<Textarea tone="caution" message="Caution message" highlightRanges={...} />
Alert: Design uplift (#1269)
Refine the design to use consistent horizontal container inset, aligning content with elements like Card
, as well as simplifying the design by removing the sidebar/keyline (consistent with useToast
).
Button, ButtonLink: Align ghost
border width with field border width (#1274)
Align the border width of ghost
variants with the border width of fields.
This is the final re-alignment piece to ensure all components use theme scales consistently, improving the ability of Braid themes to deliver cohesive design uplift.
Stepper: Reduce size of Step
indicators (#1275)
Refine the design of Step
indicators by reducing their size.
TooltipRenderer: Remove custom background (#1268)
Use the correct semantic token for the background of tooltips. While there is no visual change, this is just a clean up to ensure the palette usage remains consistent.
Box, atoms, vars: Add small
to border radius scale (#1253)
Extends the border radius scale to include small
as a step below standard
.
This addition is to support an upcoming design uplift that requires greater fidelity in the scale.
Note, the new value is also available as a responsive property.
EXAMPLE USAGE:
<Box borderRadius="small" />; { /* Or responsively: */ } <Box borderRadius={{ mobile: 'small', tablet: 'standard' }} />;
import { atoms } from 'braid-design-system/css'; atoms({ borderRadius: 'small' });
import { vars } from 'braid-design-system/css'; const radius = vars.borderRadius.small;
theme: Add support for defining line heights with lineGap (#1267)
Provide support for themes to define their typographic line heights via lineGap
.
This allows us to reason about the white space between wrapping lines of text in the same way we think about Stack
spacing.
For a visual preview of this mental model head over to the Capsize website.
Add xxxlarge
to the space scale (#1262)
Extends the range of the space scale to include xxxlarge
.
This addition is to support an upcoming design uplift that requires greater fidelity in the scale.
Note, the new value is also available as a responsive property.
EXAMPLE USAGE:
<Stack space="xxxlarge">...</Stack>; { /* Or responsively: */ } <Stack space={{ mobile: 'large', tablet: 'xxxlarge' }}>...</Stack>;
import { atoms } from 'braid-design-system/css'; atoms({ paddingY: 'xxxlarge' });
import { vars } from 'braid-design-system/css'; const space = vars.space.xxxlarge;
theme: Add support for webfonts beyond Google Fonts (#1255)
Previously the webFont
on the theme was the familyName
and was being used to construct a link tag to a Google Fonts stylesheet and provide to consumers via a runtime token.
To enable fonts beyond Google Fonts, we are changing webFont
to be a URL.
This does not impact existing themes (as there are no themes currently with a web font), and the contract of the runtime token (a constructed link tag) remains unchanged.
MenuRenderer: Hide overflow on menu (#1264)
Fixes a bug where the selection/highlight for a MenuItem
could extend outside of the menu itself.
Badge: Adjust height to support different typographic scales (#1257)
Adjusts the height of Badge
to be driven by the capHeight of xsmall
text plus vertical padding, rather than xsmall
line height.
This enables different typographic scales across themes, while ensuring the Badge
height is relative.
RadioItem, Toggle: Use formAccent border when selected (#1251)
Switch to using the formAccent
border colour, rather than the field
border color, when in the selected state (e.g. checked
for RadioItem
, on
for Toggle
).
Fix error reading standard
of undefined (#1256)
The use of dynamic property access left some styles exposed to being marked as unused and tree shaken away.
Refactoring these styles to be explicitly referenced to ensure this will not be the case.
TooltipRenderer: Refine padding to complement radius scale (#1263)
Removes the custom padding on tooltips in favour of using the space scale. Previously, a custom value was used to complement the over sized radius which has now be reduced.
Button, ButtonLink: Improve support for different typographic scales (#1259)
Ensure the height of a small
sized Button
is not reliant on the text line height.
This enables different typographic scales across themes, while ensuring the Button
height is relative.
Alert, Card, useToast: Decouple keyline width from space scale (#1266)
Previously the keyline width on the left determined its width using the space scale. Re-aligning this to use the grid unit to enable themes with larger space scales.
Improve consistency of border radius usage across components (#1253)
Over time, individual components have reached for a larger radius in the scale, rather than increasing the scale at a theme level. This resulted in inconsistent use across the system, preventing uplift of the scale.
Re-aligning all components to use the scale consistently enables themes to apply very different radius scales — enabling an upcoming design uplift theme.
Dialog, Drawer: Reduce space between title and description (#1265)
Reducing the space between title
and description
to small
to improve association of the header block content
Prevent wrong entry point paths from appearing as suggestions in VS Code. (#1247)
For example, wanting to use Braid's CSS variables (vars
) VS Code would suggest braid-design-system/dist/css
instead of braid-design-system/css
.
Disclosure: Add weight
support (#1240)
Provides support for reducing the visual weight of the Disclosure's call to action. Follows the same contextual styling rules as TextLink
.
EXAMPLE USAGE:
<Disclosure weight="weak">...</Disclosure>
Disclosure: Add inline content support (#1240)
Provides support for using a Disclosure within a sentence by allowing it to be nested within a typographic component, i.e. Text
.
All size and weight properties will inherit from the parent component.
EXAMPLE USAGE:
<Text> Preceding text content that is followed by a Disclosure. <Disclosure expandLabel="Read more">...</Disclosure> </Text>
Button, ButtonLink, TextLink, TextLinkButton: Add support for trailing icons (#1242)
Provide support for choosing the position of the icon
slot within a Button
or TextLink
.
By default, the iconPosition
will be leading
the label, but optionally, can be set to trailing
.
EXAMPLE USAGE:
<Button icon={<IconArrow direction="right" />} iconPosition="trailing"> Next </Button>
Show description
on form fields when no label
provided (#1239)
Previously, a FieldLabel
without a label
would return nothing. However, now that form fields can opt for indirect or hidden labels (via aria-label
or aria-labelledby
), the description
should still be shown if provided.
Note: The secondaryLabel
and tertiaryLabel
remain conditional based on the presence of a label
. This is due to their location in the layout being anchored off the label
.
EXAMPLE USAGE:
<FieldLabel description="Description now visible without label" />
TextLink, TextLinkButton: Increase text weight of weak links (#1237)
Increases the text weight of weak
links to medium
, increasing the affordance against standard text.
As a result, this makes the weight of all text links consistent.
Disclosure: Ensure chevron does not wrap alone (#1240)
Fixes the scenario where based on copy length and container size, the chevron could wrap independently of the rest of the label. By using a zero-width, non-breaking space, the chevron will now wrap together with the last word of the label.
By moving to Crackle, Braid will now be published as a pre-compiled artefact, no longer requiring TypeScript to be transpiled by consumers. This should see faster build times and clearer boundaries between Braid and consuming applications.
Outside of the removal of treat
and the legacy themes, there is no impact on the public API of Braid. However, if a consuming web app is reaching into Braid internals, this will no longer work and require code changes.
For these cases, to support teams in upgrading we have provided a Compiled Braid Migration Guide based on patterns observed in code bases.
For more detail on the specific changes in this release, please read on.
Drop support for React 16. (#1229)
To support the pre-compilation of Braid, it is now a requirement that consumers are on React 17 or later. Originally the plan was to drop React 17 as well, however the team has been able to maintain support for a little longer — but there is a catch (see migration guide below).
MIGRATION GUIDE:
As this version is no longer supported it is a requirement that consumers upgrade. For more information on the differences between v16 and v17, see the React blog. We strongly encourage teams to take this opportunity to upgrade to v18 as well.
The way React 17 exposes the jsx-runtime
is not compatible with ESM, which means the bundler will need instructions on how to resolve the import.
This can be done by adding a fallback module resolve rule to the webpack configuration.
For sku consumers, this can be done as follows:
// sku.config.ts { dangerouslySetWebpackConfig: (config) => webpackMerge(config, { resolve: { fallback: { 'react/jsx-runtime': require.resolve('react/jsx-runtime'), }, }, }), }
We recommend using webpack-merge to ensure both configurations are deep merged correctly.
Note: This rule can be removed after upgrading to React 18, which has ESM support.
No action required.
Playroom imports are now formalised entrypoints rather than path imports, and as such no longer require the file path extensions to be provided. (#1229)
EXAMPLE USAGE:
// playroom.config.js module.exports = { frameComponent: require.resolve( 'braid-design-system/playroom/FrameComponent', ), components: require.resolve('braid-design-system/playroom/components'), snippets: require.resolve('braid-design-system/playroom/snippets'), scope: require.resolve('braid-design-system/playroom/scope'), };
Remove legacy themes: catho
, occ
and seekAnz
(#1229)
The seekAnz
theme facilitated consumers migrating like-for-like from seek-style-guide
, while the catho
and occ
themes intended to enable a specific use case that never eventuated.
Removing these themes allows us to move faster with upcoming theme uplift work.
MIGRATION GUIDE:
Any remaining consumers of the catho
, occ
or seekAnz
themes should migrate to the apac
theme like so:
-import seekAnz from 'braid-design-system/themes/seekAnz'; +import apac from 'braid-design-system/themes/apac';
Remove treat support (#1229)
Treat has been deprecated for nearly 2 years, superseded by vanilla-extract.
.treat.ts
files can no longer be used for styling and should be converted to .css.ts
(vanilla-extract) stylesheets.
Remove experimental color-mode check script (#1229)
The experimental script for checking which color mode to render has been formalised to an entrypoint specific to the mechanism that is being used — in this case the query parameter. In the future we may add other mechanisms, such as local storage for example, but for now all existing consumers should have been migrated to the query-param check.
MIGRATION GUIDE:
- import { __experimentalDarkMode__ } from 'braid-design-system/color-mode' + import { colorModeQueryParamCheck } from 'braid-design-system/color-mode/query-param'
Use theme tokens for shape of font metrics (#1214)
Internally some theme utilities were using Capsize’s FontMetrics
as their expected payload, rather than correctly using the shape of the theme tokens.
This makes Braid compatible with Capsize v3.x.
Whitelist only the required FontMetrics for theme tokens (#1212)
The latest version of FontMetrics
type in Capsize adds more properties, and we only populate the properties we require on the theme. Whitelisting the required properties to keep the themes explicit.
Accordion, AccordionItem: Add weight
support (#1211)
Add support for customising the weight
of AccordionItem
s.
This can be either at an Accordion
level or on a standalone AccordionItem
based on design requirements.
Note, in order to maintain visual consistency, the weight
prop can only be specified on an AccordionItem
when outside of an Accordion
.
EXAMPLE USAGE:
<Accordion weight="strong"> <AccordionItem /> ... </Accordion>
or
<AccordionItem weight="strong" />
CheckboxStandalone: Enable alignment with Text (#1209)
Enables CheckboxStandalone
to be wrapped in a Text
component, ensuring it only occupies the same layout as text.
This is useful for visually aligning checkboxes in a custom layout alongside other text-based components, e.g. AccordionItem
.
EXAMPLE USAGE:
<Columns> <Column> <Text> <CheckboxStandalone /> </Text> </Column> <Column> <AccordionItem /> </Column> </Columns>
color-mode: Add query-param entry (#1205)
Add new query-param
entry, providing a script for resolving the color mode preference from query string, as well as a utility function for retrieving the preference for constructing subsequent links.
Tab, Tabs: Updated visual design (#1180)
The appearance of a Tab
has been updated. Changes include:
regular
text weightneutral
tone instead of underlineminimal
divider under Tabs
underlines content only, without the horizontal gutterThe braid-upgrade
command now tries to preserve newlines as best as possible (#1194)
Expose Playroom config (#1190)
This allows consuming packages (e.g. Metropolis) to enhance the Playroom experience by leveraging Braid's internal Playroom configuration.
EXAMPLE USAGE:
// playroom.config.js module.exports = { frameComponent: require.resolve( 'braid-design-system/playroom/FrameComponent.tsx', ), components: require.resolve('braid-design-system/playroom/components.ts'), snippets: require.resolve('braid-design-system/playroom/snippets.ts'), scope: require.resolve('braid-design-system/playroom/scope.ts'), };
TextLink, TextLinkButton: Add icon
support (#1184)
Provides a designed slot for adding an icon
to a TextLink
or TextLinkButton
.
This solves for the problem of underlining the space between the icon and text.
EXAMPLE USAGE:
<Text> <TextLink icon={<IconLink />}>...</TextLink> </Text>
IconRenderer: Support the sizing and alignment of custom icons (#1185)
Provides support for sizing and aligning custom icons with Braid’s typographic components. The new IconRenderer
component supports being used within Text
and Heading
components as well as inside icon
slots of other components.
Uses the render prop pattern to provide the required classes to style and align a custom icon.
EXAMPLE USAGE:
<Heading level="1"> <IconRenderer> {({ className }) => <svg className={className}>...</svg>} </IconRenderer> </Heading>
Link: Support custom data
prop format for attributes (#1182)
While Link
already supports the native HTML syntax for data attributes, e.g. data-testid="123"
, it now supports the data
prop too. This allows data attributes to be provided consistently to all components.
EXAMPLE USAGE:
<Link + data={{ testId: 'myComponent' }} />
The above example results in the following HTML attribute being set on the element: data-testId="myComponent"
.
Support data attribute boolean values (#1182)
The data
attribute map now supports boolean values. This provides an improvement for the developer experience, no longer having to convert values to strings explicitly.
EXAMPLE USAGE:
<Component data={{ 'custom-attribute': true, }} /> // => <div data-custom-attribute="true" />
TextLink: Allow native data attributes with anchor api (#1182)
Disables the validation against the use of data attributes on TextLink
. Given it exposes the full native anchor tag api, it is not invalid
to use the native syntax.
TextField: Add inputMode
and step
support (#1174)
Provide support for the native inputMode
and step
attributes.
The inputMode
will also be defaulted based on the specified type
. For example: <TextField type="number" />
will default the inputMode
to numeric
.
EXAMPLE USAGE:
<TextField inputMode="numeric" step=".01" />
Rating: Only fill star for scores .75 and above (#1176)
A star is only filled
when the score is .75 and above. Fixes an issue where all scores .5 or above are shown as half filled stars.
EXAMPLE USAGE: Now when a rating reaches .75 it will round up to a full star.
<Rating rating={3.75} /> // 4 filled
ButtonLink: Allow native data attributes with anchor api (#1178)
Disables the validation against the use of data attributes on ButtonLink
. Given it exposes the full native anchor tag api, it is not invalid to use the native syntax.
Box, atoms: Remove native buttons on number input field (#1174)
Extends the CSS reset behaviour of HTML input fields where type="number"
to remove the native increment and decrement buttons.
EXAMPLE USAGE:
The following will now render a HTML input of type number
without native buttons:
<Box component="input" type="number" />
Additionally, if using the atoms
function to build styles, when resetting an input
field, the native buttons will also be removed.
const customClasses = atoms({ reset: 'input', ... });
Button, ButtonLink: Improve alignment of transparent buttons with icons against Text with icons (#1170)
To improve optical balance of a Button
with an icon
, the icon container is bled to the left to balance against the larger horizontal inset of a standard
button.
This alignment correction is now only applied on standard
sized buttons that are not using the transparent
variant.
Isolating this alignment correction enables transparent buttons to better align with other components with icon
slots, for example:
<Stack space="small"> <Text icon={<IconSend />}>Text</Text> <Button icon={<IconSend />} variant="transparent" bleed> Button </Button> </Stack>
Icons and text will now be perfectly aligned between Button components and others icon slots with the same text size.
Box: Support custom data
prop format for attributes (#1168)
While Box
already supports the native HTML syntax for data attributes, e.g. data-testid="123"
, it now supports the data prop too. This allows data attributes to be provided consistently to all components.
EXAMPLE USAGE:
<Box + data={{ testId: 'myComponent' }} />
The above example results in the following HTML attribute being set on the element:
data-testId="myComponent"
.
Text, Heading: Add icon slots (#1160)
Provides a designed slot for adding an icon to Text
and Heading
components
EXAMPLE USAGE:
<Text icon={<IconPromote />}>{...}</Text>
or with a Heading
:
<Heading level="3" icon={<IconPromote />}>{...}</Heading>
useToast: Add data
attribute support (#1168)
Support applying custom data attributes to Toast elements.
EXAMPLE USAGE:
export const Component = () => { const showToast = useToast(); return ( <Button onClick={() => showToast({ + data: { testId: 'myToastMessage' }, ... }) }> Show </Button> ); }
The above example results in the following HTML attribute being set on the toast element:
data-testId="myToastMessage"
.
Provide dev time validation/warnings when the native data attribute format is provided to components that do not support it. (#1168) This is required as TypeScript does not validate kebab cased properties, and Braid components do not spread abritrary props.
This validation will prevent silent failures where attributes are seemingly provided, but not applied.
For example:
<Card data-testid={123} /> // => Would not be applied and TypeScript would not error.
However, now the following console warning will guide users to use the data
prop:
Braid components do not support the native data attribute format. Use the “data” prop instead. <Component - data-testid={123} + data={{ + testid: 123, + }} /> For more details, see the “Data Attributes” documentation: https://seek-oss.github.io/braid-design-system/components/Box#data-attributes
Pagination: Increase chevron spacing on prev/next links (#1160)
Increases the space between the "Previous" and "Next" text and their chevron icons to balance with the larger icon size.
MenuItemCheckbox: Align with increased icon size (#1160)
Ensure menu item text has uniform spacing to the checkbox of MenuItemCheckbox
and the icon
slot of MenuItem
.
Text, Heading: Increase icon size inside typographic elements (#1160)
The size of icons has been increased by 20% when used inside of Text
and Heading
components. There is no layout impact expected for consumers, with only the visual ratio of icon to text size changing.
This applies to icons using the new icon
slots, as well as inline icons within the text content.
Icons used outside of typographic elements are not affected by this change.
ButtonIcon: Increase standard icon size (#1160)
Adopt the increased standard icon size.
Note this does not affect overall dimensions of ButtonIcon
, or the layout of surrounding components.
Removes custom icon sizing and layout in favour of new typography icon sizes and layout. (#1162)
Update @vanilla-extract/css
dependency (#1158)
This fixes a type error that was occurring with typescript versions >=4.5.0
Heading: Nested icons inherit text colour (#1153)
When using icons inside of a Heading
, the default tone
was always neutral
, rather than inheriting the colour of the nearest component.
For example, when an icon was used inside of a TextLink
within a Heading
:
<Heading level="1"> Title with{' '} <TextLink> link <IconArrow /> </TextLink> </Heading> // => Previously, IconArrow was the heading text colour // `neutral`, now inherits the `link` colour.
or equally, when an icon was used inside of a Secondary
component within a Heading
:
<Heading level="1"> Title with{' '} <Secondary> secondary <IconArrow /> </Secondary> </Heading> // => Previously, IconArrow was the heading text colour // `neutral`, now inherits the `secondary` colour.
Autosuggest: Add configurable message for no suggestions (#1140)
Provides consumers a way to give the user more context when no suggestions are available. The noSuggestionsMessage
prop accepts a simple message by providing a single piece of text. Alternatively, a more structured prompt can be shown by providing an object containing title and description.
This message is only displayed when there are no available suggestions provided.
EXAMPLE USAGE: For the simple case:
<Autosuggest ... suggestions={[]} noSuggestionsMessage="No results found" />
Or, for more a structured prompt:
<Autosuggest ... suggestions={[]} noSuggestionsMessage={{ title: "No results found", description: "Try searching for something else", }} />
MIGRATION GUIDE:
In addition, the old mechanism allowing consumers to pass an object to suggestions
containing a message
has been deprecated. This will continue to work for now but will be removed in a future release.
It is recommended to migrate to the noSuggestionsMessage
prop.
<Autosuggest ... - suggestions={{ message: 'No results found' }} + noSuggestionsMessage="No results found" />
useToast: Add neutral tone support (#1141)
Add support for neutral
tone. When using a neutral
tone, an icon may optionally be provided. For consistency, the tone of the icon is set to secondary and cannot be customised.
EXAMPLE USAGE:
import { useToast } from 'braid-design-system'; export const DemoButton = () => { const showToast = useToast(); return ( <Button onClick={() => showToast({ tone: 'neutral', icon: <IconBookmark />, message: 'Neutral with icon', }) } > Show Toast </Button> ); };
react-dom
as a peer dependency (#1136)vars: Expose shadow palette (#1133)
Provide access to the themed shadow
scale on the vars
object
EXAMPLE USAGE:
import { vars } from 'braid-design-system/css'; export const dropShadow = style({ boxShadow: vars.shadow.small, });
IconArrow: Add component (#1130)
Add new IconArrow
component. The orientation of the arrow can be controlled using the direction
prop.
EXAMPLE USAGE:
<IconArrow direction="left" />
Stepper: Add align prop (#1126)
Provide the align
prop which now includes support for left
alignment.
EXAMPLE USAGE:
<Stepper align="left">...</Stepper>
RadioGroup: Remove surrounding white space with no visual label (#1129)
Removes additional white space applied above the RadioItem
s when no visible label
is provided, i.e. when labelling via aria-label
or aria-labelledby
.
Stepper: Fix clipping of step name in Safari (#1126)
Fixes issue where the descenders in Step labels were being clipped only in Safari.
Rating: Add variant
prop and deprecate showTextRating
(#1123)
Provide the variant
prop to allow customising the appearance. This supports the new minimal
appearance, which presents a single star alongside the text rating.
Also adding the starsOnly
variant as a replacement for the now deprecated showTextRating={false}
.
EXAMPLE USAGE:
<Rating rating={3.7} variant="minimal" />
MIGRATION GUIDE:
The showTextRating
prop is now deprecated. If you were using this previously, please migrate to the new variant
prop using starsOnly
.
<Rating rating={3.7} - showTextRating={false} + variant="starsOnly" />
IconPlatformAndroid, IconPlatformApple, IconSocialYouTube: Add new icons (#1121)
Add icons for the Apple and Android mobile platforms as well as YouTube
EXAMPLE USAGE:
<IconPlatformAndroid /> <IconPlatformApple /> <IconSocialYouTube />
apac
and seekBusiness
themes: Update colour palette (#1104)
The colours used in these themes have been updated to the latest design standards as they were subtly off due to coming from an incorrect source.
MenuRenderer, OverflowMenu: Provide context data to onClose (#1115)
The onClose
handler now receives data to allow consumers to discern why the menu closed — either by exiting or selecting an action. See the documentation for more details.
EXAMPLE USAGE:
<MenuRenderer onClose={(closeReason) => { // ... }} />
RadioItem: Add disabled
support (#1108)
Provide support for disabling individual RadioItem
s within a RadioGroup
.
EXAMPLE USAGE:
<RadioGroup> <RadioItem label="One" value="1" /> <RadioItem label="Two" value="2" /> <RadioItem label="Three" value="3" disabled={true} /> </RadioGroup>
Button, ButtonLink: Ensure bleedY
is backwards compatibile for transparent
variant (#1106)
Ensure that bleedY
applies bleed only vertically on transparent
variant, isolating the new horizontal bleed to the new bleed
prop exclusively.
Button, ButtonLink: Improve Button bleed
(#1103)
Previously the bleedY
prop allowed the background of Button
to bleed vertically into the surrounding layout. This worked well for all variants except transparent
, which needed to bleed horizontally as well.
To support this we have introduced the bleed
prop which will apply the bleed based on the variant
. We have also deprecated bleedY
which will be removed in a future release.
EXAMPLE USAGE:
<Button - bleedY + bleed {...} > Button </Button>
MIGRATION GUIDE
Migration from bleedY
to bleed
can be automated by running the Braid upgrade command, passing the v31.11
version. You must provide a glob to target your project’s source files. For example:
yarn braid-upgrade v31.11 "**/*.{ts,tsx}"
It is recommended to visually review the any Button
usage with the transparent
variant, to ensure the layout is as expected.
Bleed: Support using span elements via component prop (#1094)
Setting the component
prop to span
will now ensure all elements controlled by Bleed
are span
s. This is useful when using layout components inside dom elements that should not contain div
s from a HTML validation perspective.
EXAMPLE USAGE:
<Bleed space="medium" component="span"> ... </Bleed>
Dialog, Drawer: Prevent sticky close button container from blocking content (#1097)
Fix regression introduced when migrating the close action to use ButtonIcon
. The close action container was blocking the content of the Dialog
/Drawer
, and when scrolling could prevent a user from interacting with the content as it went behind the container.
Additionally, re-introduced the surface coloured background behind the button to prevent the button from visually colliding with content when scrolling.
Tab: Add icon support (#1089)
Provides a designed slot for adding an icon to a Tab
EXAMPLE USAGE:
<Tab icon={<IconPromote />}>{...}</Tab>
AccordionItem: Add icon support (#1086)
Provides a designed slot for adding an icon to an AccordionItem
EXAMPLE USAGE:
<AccordionItem icon={<IconPromote />} {...} />
Tag: Add id
support (#1081)
Button, ButtonLink: Add icon support (#1090)
Provides a designed slot for adding an icon to a Button
or ButtonLink
EXAMPLE USAGE:
<Button icon={<IconSend />}>{...}</Button>
Tag: Add icon support (#1087)
Provides a designed slot for adding an icon to a Tag
EXAMPLE USAGE:
<Tag icon={<IconPromote />} {...} />
OverflowMenu: Add id
support (#1081)
ButtonIcon: Add component (#1084)
See documentation for full feature set.
EXAMPLE USAGE:
<ButtonIcon icon={<IconShare/>} label="Share" id="share" onClick={...} />
Divider: Use span element (#1089)
As the Divider
component is not used as a container element, we now use a span
. This allows it to be used inside button
elements, such as a Tab
, without producing invalid html.
Badge: Use span element (#1086)
As the Badge
component is not used as a container element, we now use a span
. This allows it to be used inside button
elements, such as an AccordionItem
, without producing invalid html.
TooltipRenderer: Ignore pointer events on tip container (#1082)
Fix for the container of the tooltip interferring with pointer events of the tooltip trigger itself.
MenuRenderer, OverflowMenu: Guard against open/close handlers firing incorrectly (#1088)
Add guard to ensure open and close handlers are not re-fired when handler instances are updated.
Autosuggest, PasswordField, TextField, useToast: Add id
to internal close/clear buttons (#1081)
Autosuggest, Dialog, Drawer, OverflowMenu, Tag, TextField, useToast: Migrate to use ButtonIcon (#1084)
Adopt new ButtonIcon
for clear/close actions in favour of custom internal buttons.
useToast: Add closeLabel
prop (#1079)
To support translations, the close button can now be customised using the closeLabel
prop.
EXAMPLE USAGE:
<Button onClick={() => showToast({ closeLabel: 'Close', // ... }) } />
Autosuggest, TextField: Add clearLabel
prop (#1079)
To support translations, the clear button in the field can now be customised using the clearLabel
prop.
EXAMPLE USAGE:
<Autosuggest clearLabel="Clear" // ... />
Loader: Apply WAI-ARIA alert pattern (#1079)
To improve the feedback of the Loader
provided to screen readers, we now apply the WAI-ARIA Alert Pattern using an assertive level of importance.
IconThumb: Update artwork (#1080)
MenuRenderer, OverflowMenu: Mouse leave no longer affects focus state (#1077)
Previously, moving the mouse from hovering a menu item to outside of the menu would shift focus the to the menu trigger. This is not a requirement for accessibility and introduces undesired behaviour when the trigger is used in conjunction with TooltipRenderer.
Note: As per the menu accessibility guidelines, focus will still be returned to the trigger when clicking outside the menu, selecting a menu item or pressing the escape key.
MenuRenderer, OverflowMenu: Add menu width
and placement
support (#1075)
Provides a set of width
s to control how wide the menu is, where content
is the default. The available widths are ratioed off the contentWidth
s specified on the theme.
Additionally the placement
of the menu can choose from either top
or bottom
where the latter remains the default.
EXAMPLE USAGE:
<MenuRenderer // ... width="small" placement="top" > ... </MenuRenderer>
MenuItem, MenuItemLink, MenuRenderer, OverflowMenu: Add icon
support (#1075)
Provides a designed slot for adding an icon to MenuItem
and MenuItemLink
. To compliment this we have introduced reserveIconSpace
on both MenuRenderer
and OverflowMenu
so the labels in menu items without icons align with the labels of menu items with an icon.
EXAMPLE USAGE:
<MenuRenderer reserveIconSpace> <MenuItem // ... icon={<IconBookmark />} > Menu Item </MenuItem> </MenuRenderer>
MenuItem, MenuItemLink, MenuItemChecklist: Add badge
support (#1075)
Provides a designed slot for adding a Badge
to all the variants of a menu item.
EXAMPLE USAGE:
<MenuRenderer> <MenuItem // ... badge={<Badge>Badge</Badge>} > Menu Item </MenuItem> </MenuRenderer>
Button: Support using as menu trigger (#1075)
Allow a Button
to receive all of the required props for a menu trigger. As a result a Button
now accepts onKeyUp
, onKeyDown
and aria-haspopup
.
EXAMPLE USAGE:
<MenuRenderer trigger={(triggerProps) => <Button {...triggerProps}>Button</Button>} > ... </MenuRenderer>
Column: Enure inner element honours component
prop (#1075)
Bleed: Add component (#1066)
Introduce Bleed
layout component that allows content to bleed out into the parent layout by a specified amount, useful when a content needs to negate the indent provided by a parent component.
See the documentation and layout guide for more information.
EXAMPLE USAGE:
<Card> <Stack space="gutter"> + <Bleed horizontal="gutter" top="gutter"> <Placeholder height={200} label="Header Image" /> + </Bleed> <Heading level="3">Heading</Heading> <Text>Text content</Text> </Stack> </Card>
Box, BoxRenderer, atoms: Add support for inset
shorthand (#1069)
Introduces the inset
shorthand as a convenience for applying top
, bottom
, left
and right
properties.
EXAMPLE USAGE:
<Box position="absolute" inset={0} />
or
atoms({ position: 'absolute', inset: 0, });
Pagination: Add pageLimit
support (#1070)
Add support for configuring the number of pages displayed using the pageLimit
prop. The default is still set to 7, but consumers can now reduce this, useful when Pagination
is used inside column layouts.
In addition, the layout has been stabilised, preventing the links moving when the next/prev actions are shown/hidden.
EXAMPLE USAGE:
<Pagination ... pageLimit={3} />
Columns: Support using span elements via component prop (#1064)
Setting the component
prop to span
will now ensure all elements controlled by Columns
are span
s. This is useful when using layout components inside dom elements that should not contain div
s from a HTML validation perspective.
EXAMPLE USAGE:
<Columns space="medium" component="span"> ... </Columns>
Drawer: Support positioning on the left (#1067)
A Drawer
can now enter from and be positioned on the left. The default remains unchanged and will enter from and be docked to the right.
EXAMPLE USAGE:
<Drawer ... position="left" />
Inline: Support using span elements via component prop (#1068)
Setting the component
prop to span
will now ensure all elements controlled by Inline
are span
s. This is useful when using layout components inside dom elements that should not contain div
s from a HTML validation perspective.
EXAMPLE USAGE:
<Inline space="medium" component="span"> ... </Inline>
Stack: Add support for span elements (#1060)
Stack now supports using span
elements for it's markup, this is useful when using layout components inside elements that should not contain a div
element, e.g. button
.
EXAMPLE USAGE:
<Stack component="span" space="medium"> ... </Stack>
Stepper: Add component (#1060)
See documentation for full feature set and usage details.
EXAMPLE USAGE:
<Stepper label="Linear steps" progress={3}> <Step>1. First step</Step> <Step>2. Second step</Step> <Step>3. Third step</Step> <Step>4. Forth step</Step> </Stepper>
AccordionItem: Add badge support (#1057)
The AccordionItem
now has support for the badge
prop.
EXAMPLE USAGE:
<AccordionItem label="Label" badge={<Badge>New</Badge>}> ... </AccordionItem>
Autosuggest: Scroll list into view (#1058)
The suggestions list will now be scrolled into view (on tablet and above) if it extends beyond the bottom of the window. This prevents suggestions (particularly those loaded asynchronously) from being obscured by the edge of the window.
MenuRenderer, OverflowMenu: Ensure layout of the trigger is controlled by the parent (#1055)
Fixes an issue where the trigger container did not adhere to the parent layout, preventing consumers from providing triggers that take up the full width of their available space. This goes against one of Braid's key layout principles which says spacing between elements is owned entirely by layout components.
contentWidth
theme tokens (#1052)backgroundColor
to html node when styleBody
is set (defaults to true
) (#1047)vars: Add light variant foreground colors (#1042)
New foregrounds
The following foregrounds are now available on the vars.foregroundColor
theme object:
cautionLight
infoLight
linkLight
linkLightVisited
positiveLight
promoteLight
Text: Improve contrast of caution
, positive
, info
, promote
and link
tones (#1042)
When using any of the above tones in a dark container, a lighter colour will be used to improve the text contrast against the background.
OverflowMenu: Use neutral
tone button style (#1042)
Alert, Card, Toast: Improve highlight keyline (#1042)
Ensures that components using a highlight keyline have the correct border radius and mask their overflow correctly.
Alert, Autosuggest, Tag, TextField: Use neutral
tone button style for clear action (#1042)
Box: Reset background color on input
and select
elements (#1042)
When specifying a component
of input
or select
the background color was not being reset, falling through to the user agent styles. Reseting it to transparent
to ensure predicatble styles across browsers and colour modes.
MenuItem, MenuItemLink, MenuItemCheckbox: Use span
elements internally for more valid HTML. (#1042)
Loader: Use current text color (#1042)
BraidTestProvider: Move to separate entry (#1031)
By moving BraidTestProvider
to it’s own entry, we can prevent importing all the themes at dev-time. This improves the developer experience when debugging the stylesheet that is output by the development server.
MIGRATION GUIDE
Migration can largely be automated by running the Braid upgrade command. You must provide a glob to target your project’s source files. For example:
yarn braid-upgrade v31 "**/*.{ts,tsx}"
It may be necessary to manually migrate code in some cases, here are the affected use cases:
- import { BraidTestProvider } from 'braid-design-system'; + import { BraidTestProvider } from 'braid-design-system/test';
BackgroundProvider Removed in favour of setting a background
of customDark
/customLight
directly on the Box
that has the custom background color. (#1031)
MIGRATION GUIDE
-<Box style={{ backgroundColor: 'purple' }}> +<Box background="customDark" style={{ backgroundColor: 'purple' }}> - <BackgroundProvider value="UNKNOWN_DARK"> <Text>Inverted text given dark context</Text> - </BackgroundProvider> </Box>
Remove previously deprecated ButtonRenderer
component in favour of Button
and ButtonLink
. (#1031)
MIGRATION GUIDE
If you were using this to render an a
element that visually looks like a button, you should be using ButtonLink
- <ButtonRenderer> - {(ButtonChildren, buttonProps) => ( - <a to="#" {...buttonProps}> - Visually a button - </a> - )} - </ButtonRenderer> + <ButtonLink> + Visually a button + </ButtonLink>
Button, ButtonLink: Add neutral
tone (#1031)
Introduces a neutral
tone for cases where actions need to be de-emphasised. As a result, there is a breaking change to the contextual design rules that invert buttons in dark containers.
BREAKING CHANGE:
A Button
with a variant
of ghost
, soft
, or transparent
and no specified tone
would previously invert when inside a dark container. Now, instead of inverting the foreground colour, these cases will use a lighter version of the default tone, i.e. formAccent
.
MIGRATION GUIDE:
To maintain previous behaviour, consumers should opt into the neutral
tone.
<Box background="brand" padding="gutter"> - <Button variant="ghost">Click</Button> + <Button variant="ghost" tone="neutral">Click</Button> </Box>
Remove legacy seekAsia themes (#1031)
Since the rebrand went live earlier this year, all consumers of jobsDb
, jobStreet
, jobStreetClassic
and seekUnifiedBeta
themes should now be using the apac
theme in production.
MIGRATION GUIDE
-import jobStreet from 'braid-design-system/themes/jobStreet'; +import apac from 'braid-design-system/themes/apac'; -<BraidProvider theme={jobStreet}> +<BraidProvider theme={apac}> ... </BraidProvider>
BulletList Remove deprecated component (#1031)
MIGRATION GUIDE
-<BulletList> - <Bullet large>Bullet</Bullet> - <Bullet large>Bullet</Bullet> - <Bullet large>Bullet</Bullet> -</BulletList> +<List size="large"> + <Text>Bullet</Text> + <Text>Bullet</Text> + <Text>Bullet</Text> +</List>
Remove previously deprecated TextLinkRenderer
component in favour of TextLink
and TextLinkButton
. (#1031)
MIGRATION GUIDE
If you were using this to render a button
element that visually looks like a link, you should be using TextLinkButton
<Text> - <TextLinkRenderer reset={false}> - {(textLinkProps) => ( - <Box component="button" {...textLinkProps}> - Visually a link - </Box> - )} - </TextLinkRenderer> + <TextLinkButton> + Visually a link + </TextLinkButton> , rendered as a button. </Text>
If you were using this to render an a
element or using a client side router link component you should ensure you have configured the linkComponent on BraidProvider
in your app. Once handled, migrating to TextLink
should be straight forward.
<Text> - <TextLinkRenderer reset={false}> - {(textLinkProps) => ( - <Link {...textLinkProps}> - ... - </Link> - )} - </TextLinkRenderer> + <TextLink> + ... + </TextLink> </Text>
TextLink, TextLinkButton: Remove support inside Actions
component (#1031)
Removing support for TextLink
and TextLinkButton
components inside of Actions
. This was previously deprecated back in v29.26.0 in favour of using the transparent
variant
of ButtonLink
.
MIGRATION GUIDE
<Actions> <Button>...</Button> - <TextLink href="...">...</TextLink> + <ButtonLink href="..." variant="transparent">...</ButtonLink> </Actions>
Remove BraidLoadableProvider
(#1031)
As most Apps should run the apac
theme across all brands, it no longer makes sense to centralise a loadable version of the BraidProvider
. This should simplify builds across the board and may result in a small build-speed increase.
MIGRATION GUIDE
If you are only using a single theme, then you should migrate your BraidLoadableProvider
usage to BraidProvider
.
+import apac from 'braid-design-system/themes/apac'; +import { BraidProvider } from 'braid-design-system'; -import { BraidLoadableProvider } from 'braid-design-system'; export const App = () => ( - <BraidLoadableProvider themeName="apac"> + <BraidProvider theme={apac}> ... - </BraidLoadableProvider> + </BraidProvider> );
If your app still needs to render different themes then you can replicate the BraidLoadableProvider
functionality locally using the loadable.lib
API.
import { BraidProvider } from 'braid-design-system'; import React, { ReactNode } from 'react'; import loadable from 'sku/@loadable/component'; type ThemeName = 'apac' | 'catho'; const BraidTheme = loadable.lib( (props: { themeName: ThemeName }) => import(`braid-design-system/themes/${props.themeName}`), ); interface AppProps { themeName: ThemeName; children: ReactNode; } export const App = ({ themeName, children }: AppProps) => ( <BraidTheme themeName={themeName}> {({ default: theme }) => ( <BraidProvider theme={theme}>{children}</BraidProvider> )} </BraidTheme> );
Box, atoms, vars: Update theme colour tokens with improved semantics. (#1031)
Simplifies the semantics of the colour-based tokens to support upcoming colour mode work. Changes to the property values on backgroundColor
and borderColor
has flow on affects to the apis on Box
and atoms
.
TOKEN CHANGES
New
surface
, neutralSoft
neutral
, neutralInverted
, neutralLight
Removed
card
, formAccentDisabled
, input
, inputDisabled
, selection
formHover
, standard
, standardInverted
MIGRATION GUIDE
Migration can largely be automated by running the Braid upgrade command. You must provide a glob to target your project’s source files. For example:
yarn braid-upgrade v31 "**/*.{ts,tsx}"
It may be necessary to manually migrate code in some cases, here are the affected use cases:
Box
backgrounds
- <Box background="card" /> + <Box background="surface" /> - <Box background="formAccentDisabled" /> + <Box background="neutralLight" /> - <Box background="input" /> + <Box background="surface" /> - <Box background="inputDisabled" /> + <Box background="neutralSoft" /> - <Box background="selection" /> + <Box background="formAccentSoft" />
Box
boxShadows
- <Box boxShadow="borderStandard" /> + <Box boxShadow="borderNeutralLight" /> - <Box boxShadow="borderStandardInverted" /> + <Box boxShadow="borderNeutralInverted" /> - <Box boxShadow="borderStandardInvertedLarge" /> + <Box boxShadow="borderNeutralInvertedLarge" /> - <Box boxShadow="borderFormHover" /> + <Box boxShadow="borderFormAccent" />
vars
- vars.borderColor.standard + vars.borderColor.neutralLight - vars.borderColor.standardInverted + vars.borderColor.neutralInverted - vars.borderColor.formHover + vars.borderColor.formAccent
atoms
atoms({ - boxShadow: 'borderStandard', + boxShadow: 'borderNeutralLight', }); atoms({ - boxShadow: 'borderStandardInverted', + boxShadow: 'borderNeutralInverted', }); atoms({ - boxShadow: 'borderStandardInvertedLarge', + boxShadow: 'borderNeutralInvertedLarge', }); atoms({ - boxShadow: 'borderFormHover', + boxShadow: 'borderFormAccent', });
Box: Add neutral background variants and new boxShadow border variants (#1031)
New backgrounds The following backgrounds are now available:
neutralActive
neutralHover
neutralSoftActive
neutralSoftHover
New boxShadows The following box shadows are now available:
borderBrandAccentLightLarge
borderCriticalLightLarge
borderFormAccentLight
borderFormAccentLightLarge
atoms: Add boxShadow border variants (#1031)
New boxShadows The following box shadows are now available:
borderBrandAccentLightLarge
borderCriticalLightLarge
borderFormAccentLight
borderFormAccentLightLarge
vars: Darken neutral background for the occ
theme. (#1031)
A neutral
background should be able to hold tone-based text. Moving from grey700
to grey800
as per the Atomic Design System color palette
vars: Add new backgrounds and light variant border colors (#1031)
New backgrounds
The following backgrounds are now available on the vars.backgroundColor
theme object:
neutralActive
neutralHover
neutralSoftActive
neutralSoftHover
New borderColors
The following border colors are now available on the vars.borderColor
theme object:
brandAccentLight
criticalLight
formAccentLight
vars: Darken neutral background for the seekAnz
theme. (#1031)
A neutral
background should be able to hold tone-based text. Moving from sk-mid-gray-dark
to sk-charcoal
as per the Seek Style Guide color palette
Text: Improve contrast of brandAccent
, critical
and formAccent
tones (#1031)
When using any of the above tones in a dark container, a lighter colour will be used to improve the text contrast against the background.
tabIndex
(#1025)Move @types/react
to devDependencies (#1023)
Braid requires consumers to provide React, therefore they should also provide the appropriate version of @types/react
rather than rely on the version installed in Braid.
disabled
(#1019)Autosuggest, Dropdown, MonthPicker, PasswordField, TextField, Textarea: Hide placeholder
text when field is disabled
(#1019)
Autosuggest, Checkbox, CheckboxStandalone, Dropdown, MonthPicker, TextField, Textarea, Radio, RadioGroup: Dim the field value and label when field is disabled
(#1019)
Autosuggest, TextField: Hide clear button when field is disabled
. (#1019)
apac
and seekBusiness
themes: Update colour palette (#983)
The colours used in these themes have been updated to the latest design standards.
A design review is highly recommended to ensure any custom design elements in your application still look correct when combined with these new colours.
Box: Add new background and border colours (#983)
New background
values:
brandAccentSoft
brandAccentSoftActive
brandAccentSoftHover
criticalSoft
criticalSoftActive
criticalSoftHover
formAccentSoft
formAccentSoftActive
formAccentSoftHover
New boxShadow
values:
borderCautionLight
borderCriticalLight
borderInfoLight
borderPositiveLight
borderPromoteLight
atoms: Add new boxShadow
values: (#983)
borderCautionLight
borderCriticalLight
borderInfoLight
borderPositiveLight
borderPromoteLight
vars: Add new background and border colours (#983)
New backgroundColor
values:
brandAccentSoft
brandAccentSoftActive
brandAccentSoftHover
criticalSoft
criticalSoftActive
criticalSoftHover
formAccentSoft
formAccentSoftActive
formAccentSoftHover
New borderColor
values:
cautionLight
criticalLight
infoLight
positiveLight
promoteLight
Button, ButtonLink, ButtonRenderer: The soft
variant now has a solid background colour rather than an opacity. You may need to review any usage on top of coloured backgrounds. (#983)
Box, atoms, vars: Add large
and xlarge
to borderRadius
scale (#983)
apac
and seekBusiness
themes: Increase size of focus ring (accessed via the boxShadow
value of "outlineFocus"
) and use updated colour palette. (#983)
Display formAccent
outline on form elements when focused (#983)
IconThumb, IconFlag: Add new icons (#980)
Autosuggest, Dropdown, MonthPicker, PasswordField, Textarea, TextField: Add aria-label & aria-labelledby support (#979)
In some cases it may be necessary for a field to be labelled by another element or even not to have a visual label. Instead of providing a label either aria-label or aria-labelledby can be provided.
EXAMPLE USAGE:
// Standard field label <TextField label="My field" /> // Hidden field label <TextField aria-label="My field" /> // Labelled by another element <Heading id="title">Title</Heading> <TextField aria-labelledby="title" />
Checkbox, RadioGroup, Radio: Use atoms for label cursor styles (#973)
Since the disabled state of a checkbox can only be changed via JavaScript, cursor styles can be toggled via Box
props rather than generating additional CSS.
While this is an improvement in and of itself, this change is being made to work around a third-party testing bug where our use of :disabled
in a complex CSS selector is causing an exception to be thrown.
TextField: Add characterLimit
prop (#963)
You can now provide a characterLimit
that will communicate when the input text approaches or exceeds the specified limit.
To prevent loss of information, exceeding the limit is permitted, however the count will be presented in a critical tone.
Add wide
breakpoint of 1200px (#960)
This adds support for wide
to the following touchpoints:
{ mobile: 'small', wide: 'large' }
<Columns collapseBelow="wide" space={{ mobile: 'small', wide: 'large' }}>
responsiveStyle
function, e.g.export const className = style(responsiveStyle({ wide: '...' }));
breakpoints
object, which now exposes the number 1200
via breakpoints.wide
, i.e.{ mobile: 0, tablet: 740, desktop: 940, wide: 1200 }
Add useResponsiveValue
Hook (#960)
This Hook will return the resolved value based on the breakpoint the browser viewport currently falls within (mobile
, tablet
, desktop
or wide
). As this can only be calculated in the browser, the value will also be null
when rendering server-side or statically rendering.
Note that this Hook returns a function so that it can be called anywhere within your component.
EXAMPLE USAGE
const responsiveValue = useResponsiveValue(); const screenSize = responsiveValue({ mobile: 'Small', desktop: 'Large', });
You can also resolve to boolean values for breakpoint detection.
const responsiveValue = useResponsiveValue(); const isMobile = responsiveValue({ mobile: true, tablet: false, }); const isDesktopOrAbove = responsiveValue({ mobile: false, desktop: true, });
Dialog, Drawer: Support nested Dialogs & Drawers (#959)
Remove restriction preventing the nesting of modal components, e.g. Dialog
and Drawer
. While it is still discouraged to keep experiences simple, there is no longer a technical guard against it.
Deprecate useBreakpoint
(#960)
This Hook has been deprecated in favour of the new useResponsiveValue
Hook.
This is because useBreakpoint
leads consumers to inadvertently couple themselves to the current set of breakpoints, making it risky for us to introduce new breakpoints.
For example, you may have chosen to detect large screens by checking that the user is on the (current) largest breakpoint (e.g. const isDesktop = useBreakpoint() === "desktop"
), but this logic would break if we introduced an even larger breakpoint and the Hook started returning other values.
To maintain backwards compatibility, useBreakpoint
will continue to return "desktop"
when the user is technically on larger breakpoints.
MIGRATION GUIDE
Note that the useResponsiveValue
Hook returns a responsiveValue
function, so in these cases we're double-calling the function.
-const isMobile = useBreakpoint() === 'mobile'; +const isMobile = useResponsiveValue()({ + mobile: true, + tablet: false +});
-const isTablet = useBreakpoint() === 'tablet'; +const isTablet = useResponsiveValue()({ + mobile: false, + tablet: true, + desktop: false, +});
-const isDesktop = useBreakpoint() === 'desktop'; +const isDesktop = useResponsiveValue()({ + mobile: false, + desktop: true +});