Content size category
Content size category is a user preference used to adjust text size and control content magnification in your app. This feature is especially useful for users with visual impairments or limited vision.
It’s also possible to use these values to build responsive layouts based on native settings rather than screen size.
iOS
Unistyles implementation is based on Human Interface Guidelines and the available values are:
xSmall
, Small
, Medium
, Large
, xLarge
, xxLarge
, xxxLarge
, unspecified
In addition to above categories, you can also use the Accessibility sizes, available values are:
accessibilityMedium
, accessibilityLarge
, accessibilityExtraLarge
, accessibilityExtraExtraLarge
, accessibilityExtraExtraExtraLarge
Android
There is no direct equivalent to the iOS content size category on Android. The implementation is based on Font Scale and the available values are:
Small
, Default
, Large
, ExtraLarge
, Huge
Mapping is based on the following table:
Version | Value | Font Scale |
---|---|---|
- | Small | <= 0.85 |
- | Default | <= 1.0 |
- | Large | <= 1.15 |
- | ExtraLarge | <= 1.3 |
- | Huge | <=1.5 |
2.4.0 | ExtraHuge | <=1.8 |
2.4.0 | ExtraExtraHuge | >1.8 |
Web
There is no support for the content size category on the web.
Reading the value will always resolve to unspecified
.
Usage
To get the current contentSizeCategory
you need to use UnistylesRuntime
:
For convenience, library exposes two enums to map the values mentioned above:
Advanced usage
To build layouts based on the content size category, you can use the value in your stylesheet: