SlideShare a Scribd company logo
Theming in React
Morgan Dedmon
Front end developer at Match.com
Separation of Concerns
• Container/Presentation
• Abstraction of reusable functionality
• Compositions/augmented functionality
through Higher-Order Components (HOCs)
It starts with a wireframe…
Lessons from UX design
Image Source: https://www.behance.net/gallery/32086935/Close-App-Web-Sketch-to-Design
It starts with a wireframe…
Lessons from UX design
Image Source: https://www.behance.net/gallery/32086935/Close-App-Web-Sketch-to-Design
If separation of state and UI is best practice,
why not UI and styles?
Reusability: ship your components without styles!
Style Composition
• Well defined visual design
• High visual consistency
• Easily reuse components
• Decouple components from application
• Maintainability
• Reconfigure styles across brands faster
• Redesigns and iterations
Theme
• Font
• Colors
• Images
• Text direction
• Shadows
Reusable set of visual styles for consistency across views
• Border Radiuses
• Animations
• Repeated Patterns
• Margins
• Paddings
8
Super Simple “Theme” — Color Palette
9
Dynamic Prop-Driven Theme
Theme
• Font
• Colors
• Images
• Text direction
• Shadows
Reusable set of visual styles for consistency across views
• Border Radiuses
• Animations
• Repeated Patterns
• Margins
• Paddings
Passing the Theme
• Props
• Context
• HOC
• Provider
• Decorator
Theme Manager
• Style object containing all
style info for your theme
• Can be classnames-based
or CSS in JS
Configuration for all themed styles
Theme Provider
• Wraps themed part of
application
• Exposes theme instance
and puts it into context
or props
React Bindings
Theme Connector
• HOC
• Reads theme info from context
and passes to props
• Theme passed as set of
classname objects to
components
Decorator
Themed Component
• Expects map of style classes as prop
• Knows how to apply classes in internal
implementation
Decorated Component
Needs in a Theming System
• Runtime theme switching
• Decouple component and UI style
• Easily implemented theme variations
• Support variations on component branches
• Easily overwritten
• Performance
Styling Strategies
• Theme object of injected classnames
• Classnames provided and mapped via props
• Namespaced themes
• Challenges: tree shaking, removal of old
themes, stylesheet bloat, specificity, loading
themes/fonts separately
CSS Stylesheet
Super Simple “Theme” — Color Palette
Styling Strategies
CSS Stylesheet
** A really excellent library using
a similar approach is
react-css-themr
Styling Strategies
JS Based
• Dynamic
• Theme object made up of JS object
of styles
• Variables shared between CSS and JS
• Expressiveness
• Themes can be type-safe
• Dead code elimination
• Challenges: Performance-downsides
(can often be addressed with build
plugins)
• Styletron
• React Stylesheets
• Styled-Components
• Glamour
• AirBnB react-with-styles
Dynamic Prop-Driven Theme
Helpful Resources
• Style Composition
• Patterns for Style Composition - http://jxnblk.com/writing/posts/patterns-for-style-
composition-in-react/
• Pure UI - https://rauchg.com/2015/pure-ui
• Rebass - http://jxnblk.com/rebass/
• Theming
• React Future UI - https://github.com/nikgraf/future-react-ui
• Theme-standard - https://github.com/theme-standard
• Theming Libraries
• Rethemeable - https://github.com/andreypopp/rethemeable
• React-themeable - https://github.com/markdalgleish/react-themeable
• React-with-styles - https://github.com/airbnb/react-with-styles
Questions?
Thanks for listening!

More Related Content

PDF
Implementing SharePoint: Site Customization and Branding
PPTX
Entity Framework for Cross platform apps
PPTX
Decorator Pattern
PDF
building-design-systems presentation developers
PPT
Web design-workflow
PPTX
Browsers. Magic is inside.
PPTX
Design patterns Structural
PDF
Creating Landing Pages and Layouts for Drupal 8 - DrupalCon Baltimore
Implementing SharePoint: Site Customization and Branding
Entity Framework for Cross platform apps
Decorator Pattern
building-design-systems presentation developers
Web design-workflow
Browsers. Magic is inside.
Design patterns Structural
Creating Landing Pages and Layouts for Drupal 8 - DrupalCon Baltimore

Similar to Theming in React (20)

PPTX
lec11_CSS.pptx web page description desi
PPTX
ADF - Layout Managers and Skinning
PPTX
Atlanta Drupal User Group (ADUG)
PPTX
SiriusCon17 - Eclipse Sirius at a glance
PPTX
Bootstrapify Universal Theme
PDF
Sitting in the Driver's Seat
PPT
Object Oriented Analysis & Design
PPTX
Cascading Style Sheets - CSS
PPT
the Modeling is a way of thinking about the
PPTX
Building Design Systems
PPT
Good Slides on Architecture.ppt
PDF
Introduction to CSS3
PDF
The Future is Modular, Jonathan Snook
PPTX
Maintainable Sitecore Solutions
PDF
DRY CSS A don’t-repeat-yourself methodology for creating efficient, unified a...
PDF
Dangerous CSS
PDF
CSS3: Simply Responsive
PDF
Sane CSS - A modern approach to CSS
PPTX
Building Responsive Intranet using Sharepoint Framework solutions - Asish Pad...
PDF
01 Introduction to SDA 2.pdf software architecture
lec11_CSS.pptx web page description desi
ADF - Layout Managers and Skinning
Atlanta Drupal User Group (ADUG)
SiriusCon17 - Eclipse Sirius at a glance
Bootstrapify Universal Theme
Sitting in the Driver's Seat
Object Oriented Analysis & Design
Cascading Style Sheets - CSS
the Modeling is a way of thinking about the
Building Design Systems
Good Slides on Architecture.ppt
Introduction to CSS3
The Future is Modular, Jonathan Snook
Maintainable Sitecore Solutions
DRY CSS A don’t-repeat-yourself methodology for creating efficient, unified a...
Dangerous CSS
CSS3: Simply Responsive
Sane CSS - A modern approach to CSS
Building Responsive Intranet using Sharepoint Framework solutions - Asish Pad...
01 Introduction to SDA 2.pdf software architecture
Ad

Recently uploaded (20)

PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PPTX
Current and future trends in Computer Vision.pptx
PPTX
bas. eng. economics group 4 presentation 1.pptx
PPTX
Artificial Intelligence
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PDF
Digital Logic Computer Design lecture notes
PPTX
additive manufacturing of ss316l using mig welding
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
Safety Seminar civil to be ensured for safe working.
PPT
Introduction, IoT Design Methodology, Case Study on IoT System for Weather Mo...
PPTX
Internet of Things (IOT) - A guide to understanding
DOCX
573137875-Attendance-Management-System-original
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
Current and future trends in Computer Vision.pptx
bas. eng. economics group 4 presentation 1.pptx
Artificial Intelligence
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
Operating System & Kernel Study Guide-1 - converted.pdf
Digital Logic Computer Design lecture notes
additive manufacturing of ss316l using mig welding
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
Safety Seminar civil to be ensured for safe working.
Introduction, IoT Design Methodology, Case Study on IoT System for Weather Mo...
Internet of Things (IOT) - A guide to understanding
573137875-Attendance-Management-System-original
Embodied AI: Ushering in the Next Era of Intelligent Systems
Model Code of Practice - Construction Work - 21102022 .pdf
CYBER-CRIMES AND SECURITY A guide to understanding
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
Ad

Theming in React

  • 1. Theming in React Morgan Dedmon Front end developer at Match.com
  • 2. Separation of Concerns • Container/Presentation • Abstraction of reusable functionality • Compositions/augmented functionality through Higher-Order Components (HOCs)
  • 3. It starts with a wireframe… Lessons from UX design Image Source: https://www.behance.net/gallery/32086935/Close-App-Web-Sketch-to-Design
  • 4. It starts with a wireframe… Lessons from UX design Image Source: https://www.behance.net/gallery/32086935/Close-App-Web-Sketch-to-Design
  • 5. If separation of state and UI is best practice, why not UI and styles? Reusability: ship your components without styles!
  • 6. Style Composition • Well defined visual design • High visual consistency • Easily reuse components • Decouple components from application • Maintainability • Reconfigure styles across brands faster • Redesigns and iterations
  • 7. Theme • Font • Colors • Images • Text direction • Shadows Reusable set of visual styles for consistency across views • Border Radiuses • Animations • Repeated Patterns • Margins • Paddings
  • 8. 8 Super Simple “Theme” — Color Palette
  • 10. Theme • Font • Colors • Images • Text direction • Shadows Reusable set of visual styles for consistency across views • Border Radiuses • Animations • Repeated Patterns • Margins • Paddings
  • 11. Passing the Theme • Props • Context • HOC • Provider • Decorator
  • 12. Theme Manager • Style object containing all style info for your theme • Can be classnames-based or CSS in JS Configuration for all themed styles
  • 13. Theme Provider • Wraps themed part of application • Exposes theme instance and puts it into context or props React Bindings
  • 14. Theme Connector • HOC • Reads theme info from context and passes to props • Theme passed as set of classname objects to components Decorator
  • 15. Themed Component • Expects map of style classes as prop • Knows how to apply classes in internal implementation Decorated Component
  • 16. Needs in a Theming System • Runtime theme switching • Decouple component and UI style • Easily implemented theme variations • Support variations on component branches • Easily overwritten • Performance
  • 17. Styling Strategies • Theme object of injected classnames • Classnames provided and mapped via props • Namespaced themes • Challenges: tree shaking, removal of old themes, stylesheet bloat, specificity, loading themes/fonts separately CSS Stylesheet
  • 18. Super Simple “Theme” — Color Palette
  • 19. Styling Strategies CSS Stylesheet ** A really excellent library using a similar approach is react-css-themr
  • 20. Styling Strategies JS Based • Dynamic • Theme object made up of JS object of styles • Variables shared between CSS and JS • Expressiveness • Themes can be type-safe • Dead code elimination • Challenges: Performance-downsides (can often be addressed with build plugins) • Styletron • React Stylesheets • Styled-Components • Glamour • AirBnB react-with-styles
  • 22. Helpful Resources • Style Composition • Patterns for Style Composition - http://jxnblk.com/writing/posts/patterns-for-style- composition-in-react/ • Pure UI - https://rauchg.com/2015/pure-ui • Rebass - http://jxnblk.com/rebass/ • Theming • React Future UI - https://github.com/nikgraf/future-react-ui • Theme-standard - https://github.com/theme-standard • Theming Libraries • Rethemeable - https://github.com/andreypopp/rethemeable • React-themeable - https://github.com/markdalgleish/react-themeable • React-with-styles - https://github.com/airbnb/react-with-styles