# frozen_string_literal: true

class Avo::Views::ResourceCustomIndexComponent < Avo::Views::ResourceIndex
  def initialize(**kwargs)
    @kwargs = kwargs
    @index_message = kwargs[:resource].try(:index_message) # [!code ++]
  end
end
```

Now tweak the view to conditionally render the message:

```html

<div class="flex flex-col">
  <% if @index_message.present? %> 
    <div class=" w-full shadow-lg rounded px-2 py-3 rounded relative border text-white pointer-events-auto bg-blue-400 border-blue-600 mb-4">
      <div class="flex h-full">
        <div class="ml-3 w-0 flex-1 pt-0.5">
          <p class="text-sm leading-5 font-semibold">
            <strong>MovieFest 2025</strong> • Discover what\'s trending this season in cinema 🍿 
            <%= @index_message %> 
          </p>
        </div>
      </div>
    </div>
  <% end %> 

  <%= render Avo::Views::ResourceIndexComponent.new(**@kwargs) %>
</div>
```

To use this, just add an `index_message` method to any resource:

```ruby