PureAdmin.Components.FilterCard (PureAdmin v1.1.0)

Copy Markdown View Source

Filter card component for Pure Admin.

Provides an expandable filter card with inline filters and a collapsible advanced section, matching the Svelte FilterCard component.

Summary

Functions

Renders an expandable filter card with inline filters and optional advanced section.

Functions

filter_card(assigns)

Renders an expandable filter card with inline filters and optional advanced section.

Examples

<.filter_card>
  <:filters>
    <.input_wrapper>
      <.input type="text" placeholder="Search..." />
    </.input_wrapper>
  </:filters>
</.filter_card>

<.filter_card
  is_expanded={@filters_expanded}
  on_toggle="toggle-filters"
  on_clear="clear-filters"
  on_refresh="refresh"
>
  <:filters>
    <.input_group style="flex: 1; min-width: 200px;">
      <:prepend>🔍</:prepend>
      <.input type="text" placeholder="Search..." />
    </.input_group>
  </:filters>
  <:advanced_filters>
    <.grid>
      <.column size="100" md="1-3">
        <.form_group>
          <.form_label>Category</.form_label>
          <.input_wrapper>
            <.select prompt="All" options={["A", "B"]} />
          </.input_wrapper>
        </.form_group>
      </.column>
    </.grid>
  </:advanced_filters>
</.filter_card>

Attributes

  • is_expanded (:boolean) - Whether advanced filters are visible. Defaults to false.
  • has_toggle (:boolean) - Show expand/collapse toggle button. Defaults to true.
  • has_clear (:boolean) - Show the clear all button. Defaults to true.
  • has_refresh (:boolean) - Show the refresh button. Defaults to true.
  • has_advanced_actions (:boolean) - Show Apply/Clear in advanced footer. Defaults to true.
  • is_disabled (:boolean) - Disable all filter interactions. Defaults to false.
  • is_loading (:boolean) - Loading state (disables inputs, spins refresh). Defaults to false.
  • on_toggle (:string) - phx-click event for toggle button. Defaults to nil.
  • on_clear (:string) - phx-click event for clear button. Defaults to nil.
  • on_refresh (:string) - phx-click event for refresh button. Defaults to nil.
  • on_apply (:string) - phx-click event for apply button. Defaults to nil.
  • class (:string) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • filters (required) - Main inline filter controls.
  • advanced_filters - Collapsible advanced filter section.
  • actions - Custom action buttons before toggle.