Skip to end of metadata
Go to start of metadata

Demonstrates how to apply themes to widgets. Theme settings override default styles and assets defined within the widget itself.

App Folder Location

Icon

alloy/test/apps/advanced/theming_widgets

To create a widget them, inside your Alloy project's themes/ folder create a new folder named "widgets". With that folder, create a new folder whose name matches the widget ID, such as com.somecompany.widgetname. Within that folder, create assets/ and styles/ folders that contain assets and TSS files, as usual. The contents of these folder override the assets and styles declared by the original widget.

For example, the sample application defines a widget named "starrating" whose and assets and styles are overridden by those found in the app/themes/widgets/assets and app/themes/widgets/assets folders, respectively. The sample also specifies a theme named "plusminus" that is specified as the global style by the application's config.json file. The global styles, theme styles, and widget styles are combined during compilation according to well-defined style priorities (see Style Priorities).

App folder structure


Icon

Platform-specific assets and style selectors in the widget override non-platform-specific assets and styles in your theme. See Style priorities for details.

See also

  • No labels