Skip to main content
Napps mobile applications register theme styles as reserved n-* classes in the JS UI style registry. Apply them with the class prop on any UI node. This lets your component follow the merchant’s app theme without hard-coding its colors, typography, borders, or safe-area spacing.
class accepts a space-separated string or an array of class names. Classes apply in order, and the inline style overrides values from those classes. Styles apply to the node itself; they do not inherit or cascade to child nodes. Unknown class names have no effect until registered. The host refreshes these styles when the app theme changes. The n-* names are reserved: you can apply them, but StyleRegistry.registerStyle, removeStyle, and clearAll cannot change or remove them. Register your own classes with a different prefix.

Theme class reference

Bundled classes combine the related single-purpose styles. For example, n-btn-primary combines its background, border, and radius classes; n-card combines the card background, border, radius, and padding. You can use a bundled class or compose the individual classes when you need only part of the theme style. The safe-area classes use the app’s current inset values. n-safe-x applies the theme’s horizontal safe spacing, n-safe-top and n-safe-bottom apply the current top and bottom clearances, and n-safe combines all three. On mobile, the bottom clearance accounts for the app’s bottom bar as well as the device inset. The grid variants apply the configured horizontal safe spacing for one through four product columns.

Read theme values with AppTheme

Use the global AppTheme API for theme values that do not map to style classes, such as carousel and grid layout settings and the product card title line limit.
subscribe calls your callback immediately with the current values, then again when those values change. Pass its returned ID to unsubscribe when you no longer need updates. For the complete snapshot shape, see the AppTheme type reference.