Dojo
Docs Tutorials Cookbook Blog

modern web apps

  • Access drag information
  • Manage state in your application
  • Use built-in Dojo ponyfills

performance

  • Visualize your bundle contents

rendering

  • Access a raw DOM node
  • Get the rendered dimensions of an element
  • Use JSX templating

routing

  • Generate dynamic hyperlinks
  • Render URL aware widgets
  • Get the dynamic components of a URL from within a widget

styling

  • Style a built-in widget using themes
  • Create a themeable widget
  • Style a virtual DOM node with simple CSS classes

testing

  • Test and mock the imports of a widget

widgets

  • Discover all built-in Dojo 2 widgets
  • Handle string localization within a widget
  • Lazy load a widget
  • Pass and receive properties with widgets
  • Render a list from an array
  • Render a built-in Dojo 2 widget
  • Build an SVG chart
  • Force a widget to re-render itself
  • Allow a widget to receive additional properties in TypeScript

Objective

This recipe demonstrates a simple technique for styling widgets.

Procedure

  1. Create a styles/HelloWorld.m.css CSS file and add a style rule:
.root {
    color: blue;
}
  1. Import your CSS:
import * as css from './styles/HelloWorld.m.css';
  1. Use the classes property to apply a CSS class to a virtual DOM node:
return v('div', { classes: css.root }, [ 'Hello' ]);

Additional resources

The Dojo Theming tutorial covers more advanced techniques of styling widgets

© 2018 JS Foundation, All Rights Reserved.