Overriding Components

Copy Markdown

Aurora UIX ships with a full set of UI components used by its Basic template. Every public component supports runtime override: your application can replace any component with its own implementation without forking the library or writing a custom template.

How it works

Each component module uses Aurora.Uix.ComponentsResolver to declare an Application env key. At render time, if that key resolves to a module that exports the matching function, the call is forwarded there. Otherwise the built-in default runs.

The override check happens at runtime, so you can configure different overrides per environment (e.g., test vs. production) without recompiling the library.

Partial overrides

Your override module only needs to define the specific components you want to replace. Any function not exported by the override module falls back to the Aurora UIX default automatically — you do not need to implement the full interface.

Configuration

Add one or more of the following to your config/config.exs (or an environment-specific config file):

# Replace Phoenix-compatible base components (modal, input, button, etc.)
config :aurora_uix, :core_components, MyApp.MyCoreComponents

# Replace Aurora-specific collection and form components
config :aurora_uix, :basic_components, MyApp.MyComponents

# Replace filter input components
config :aurora_uix, :basic_filtering_components, MyApp.MyFilteringComponents

# Replace routing link components
config :aurora_uix, :basic_routing_components, MyApp.MyRoutingComponents

Implementing an override module

Define a module with the same function names and arity (/1) as the defaults. A minimal example that only replaces the button component:

defmodule MyApp.MyCoreComponents do
  use Phoenix.Component

  # Only the functions you want to override are needed.
  # Aurora UIX falls back to its defaults for everything else.
  def button(assigns) do
    ~H"""
    <button type={@type} class={["my-custom-button", @class]} {@rest}>
      {render_slot(@inner_block)}
    </button>
    """
  end
end
# config/config.exs
config :aurora_uix, :core_components, MyApp.MyCoreComponents

Overridable components reference

The table below lists every overridable component, grouped by override key.

:core_componentsAurora.Uix.Templates.Basic.CoreComponents

Phoenix-compatible base components, equivalent to a standard core_components.ex.

FunctionDescription
modal/1Modal dialog with focus trap and close button
flash/1Single flash notice (info or error)
flash_group/1Grouped flash notices including disconnected states
simple_form/1Form wrapper with action slot
button/1Submit/action button
input/1Text, select, checkbox, textarea, and other input types with label and errors
label/1Form label
error/1Inline field error message
header/1Page header with title, subtitle, and actions slots
list/1Definition list (<dl>) for key/value display
back/1Back navigation link with arrow icon
icon/1Heroicon rendered as a CSS <span>

:basic_componentsAurora.Uix.Templates.Basic.Components

Aurora UIX-specific components for collection views and record navigation.

FunctionDescription
auix_simple_form/1Form wrapper used in index layout forms
auix_items/1Responsive switcher: renders auix_items_table on desktop, auix_items_card on mobile
auix_items_table/1Desktop table view for collections with sorting, filtering, and actions
auix_items_card/1Mobile card view for collections with filtering and actions
pages_selection/1Pagination bar with page numbers, ellipsis, and selected-item counts
record_navigator_bar/1Previous/next record navigation shown on form and show views

:basic_filtering_componentsAurora.Uix.Templates.Basic.Components.FilteringComponents

FunctionDescription
filter_field/1Renders condition selector and from/to inputs for a filterable field; no-ops for non-filterable fields

:basic_routing_componentsAurora.Uix.Templates.Basic.RoutingComponents

FunctionDescription
auix_link/1Anchor tag that fires auix_route_forward for navigate: or patch: targets
auix_link_back/1Anchor tag that fires auix_route_back (unstyled)
auix_back/1Styled back link with a left-arrow icon that fires auix_route_back

LiveComponents

Aurora.Uix.Templates.Basic.ConfirmButton and Aurora.Uix.Templates.Basic.EmbedsManyComponent are Phoenix LiveComponents and are not overridable through this mechanism. To customise their behaviour, define custom actions using Aurora.Uix.Templates.Basic.Actions and supply your own LiveComponent module.