PhoenixKitWeb.Components.Dashboard.MultiContextSelector (phoenix_kit v1.7.71)

Copy Markdown View Source

Wrapper component for rendering multiple context selectors.

This component filters selectors by position and sub_position, sorts them by priority, and renders them in a flex container.

Usage

Header position (start):

<.multi_context_selector
  position={:header}
  sub_position={:start}
  configs={@context_selector_configs}
  contexts_map={@dashboard_contexts_map}
  current_map={@current_contexts_map}
  show_map={@show_context_selectors_map}
/>

Sidebar position (end):

<.multi_context_selector_sidebar
  position={:sidebar}
  sub_position={:end}
  configs={@context_selector_configs}
  contexts_map={@dashboard_contexts_map}
  current_map={@current_contexts_map}
  show_map={@show_context_selectors_map}
/>

Summary

Functions

Checks if multi-selector is enabled and there are any selectors to show.

Renders multiple context selectors for header position.

Renders mobile context selectors for all keys.

Renders multiple context selectors for sidebar position.

Functions

has_visible_selectors?(assigns)

Checks if multi-selector is enabled and there are any selectors to show.

Use this to conditionally render the multi-selector container.

Attributes

  • configs (:list) (required)
  • show_map (:map) (required)
  • position (:atom) - Defaults to :header.
  • sub_position (:atom) - Defaults to :start.

multi_context_selector(assigns)

Renders multiple context selectors for header position.

Filters selectors by position and sub_position, sorts by priority.

Attributes

  • position - The position to filter by (:header or :sidebar)
  • sub_position - The sub_position to filter by (:start, :end, or {:priority, N})
  • configs - List of all ContextSelector configs
  • contexts_map - Map of key => list of contexts
  • current_map - Map of key => current context
  • show_map - Map of key => boolean (whether to show selector)
  • class - Additional CSS classes
  • separator - Optional separator between selectors

Attributes

  • position (:atom) - Defaults to :header.
  • sub_position (:atom) - Defaults to :start.
  • configs (:list) (required)
  • contexts_map (:map) (required)
  • current_map (:map) (required)
  • show_map (:map) (required)
  • class (:string) - Defaults to "".
  • separator (:string) - Defaults to nil.

multi_context_selector_mobile(assigns)

Renders mobile context selectors for all keys.

Attributes

  • configs (:list) (required)
  • contexts_map (:map) (required)
  • current_map (:map) (required)
  • show_map (:map) (required)

multi_context_selector_sidebar(assigns)

Renders multiple context selectors for sidebar position.

Uses sidebar-specific styling for vertical layout.

Attributes

  • position (:atom) - Defaults to :sidebar.
  • sub_position (:atom) - Defaults to :start.
  • configs (:list) (required)
  • contexts_map (:map) (required)
  • current_map (:map) (required)
  • show_map (:map) (required)
  • class (:string) - Defaults to "".