Breakpoints
StableBreakpoint tokens are used to keep services and products using HDS consistent across all screen sizes.
Usage
HDS includes tokenized values for both breakpoints and a maximum container width. Breakpoint tokens can be also used alongside HDS grid guidelines in order to create consistent designs and implementations.
HDS offers a Container component which follows breakpoint and container width tokens automatically. It is recommended to use it if possible. For more info and examples, see Container - React documentation and Container - Core documentation.
Principles
- Always use token of the same level for both the breakpoint and container width. This ensures consistency across all services using HDS breakpoint tokens. Read more about this in the breakpoint usage section.
- Aim to provide all breakpoints listed in HDS tokens in your service. This way you ensure your service is usable with every common screen width.
- For best results, test your designs and implementations at the edge of each HDS breakpoint.
- HDS uses a simple method to scale content when the screen size changes. Below the
--container-width-xl
the content container always takes all available space.- It is recommended to use scaling methods HDS suggests for each breakpoint (see Breakpoints token table). However, it is allowed to use different scaling methods if it works better for the service.
Accessibility
- Carefully test your implementation at different breakpoints - especially at the edge values of a breakpoint.
- Pay extra attention how your service behaves if browser zoom functionality is used. Read more about the WCAG requirements considering reflow.
Using breakpoint tokens
The breakpoint tokens are divided into two sets;
- Breakpoint tokens define exact widths (in pixels) where the next breakpoint comes into effect.
- Container width token defines maximum container width.
When breakpoints change the left and right padding of the container changes. It is recommended to use the provided padding values because they match with HDS Navigation and HDS Footer paddings. You can find these paddings on the HDS Breakpoints tokens tab.
The maximum content container width is always --container-width-xl
(1200px). When the viewport width is below this value, the content container always takes all available space.