Skip to content

I have a react app using the TopNavigation component- how can I apply a theme to change the background color? #2771

Answered by surfgeek
surfgeek asked this question in Q&A
Discussion options

You must be logged in to vote

Fixed it! Wow that was absurdly painful. Maybe it's intentional but the package naming was a challenge to start and didn't follow any examples I found, i.e. components-themeable, components/theming. Anyways this actually worked:

import { Theme } from "@cloudscape-design/components-themeable"
import { applyTheme } from '@cloudscape-design/components/theming';

const theme: Theme = {
  tokens: {},
  contexts: {
    'top-navigation': {
      tokens: {
        colorBackgroundContainerContent: '#005abc'
      },
    },
  },
};

applyTheme({ theme });

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by surfgeek
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant