The Context Selector is used when the data/resources shown in the UI are dependent on context. It is useful when the UI cannot show data for multiple contexts simultaneously, or when it makes sense not to. Different contexts within a product should share the same navigation, but will differ in the data shown. Examples of contexts could include concepts such as region, project, or organization, but the specific notion of context is defined by the individual product.
The context selector should appear as a dropdown in the Masthead, next to the application branding.
This pattern should NOT be used:
- When there is a need to select more than one context within a single layer of context (multiselect).
- As a shortcut for other navigation items.
- To navigate to a different “product area” with different navigation options/features. For that use case, consider the Launcher.
- If the context names are user-generated, a label should be included above the selector.
- If there is a search bar, it should be at the very top of the menu.
- If there are many items (i.e. more than 12), the dropdown should scroll and a search field should be added to filter the list as the user types.
- Because the context identifies what is in the UI, the Context Selector should remain visible at smaller viewports.
- Product branding should be dropped in favor of keeping the context visible.
- If the product branding served as navigation, that navigation item should be added to the hamburger menu.
Context names may need to be truncated if the names are very long, or if horizontal space is tight. Names should be truncated in a way that makes sense for the product or application. See PatternFly’s guidelines on truncation.