© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
1 reply
Arnaud

Repeater show field based on line number

Hello,

I would like to display a field in my repeater only if the current repeated element is not the first.

I've done this code that works well but I'm sure there is a better way to do it :

->visible(function (Component $component, Get $get) {
  if ($get('../../conditions') === null) {
    return false;
  }

  $statePath = $component->getContainer()->getStatePath();
  $statePath = explode('.', $statePath);
  $statePath = end($statePath);
  
  if (array_key_first($get('../../conditions')) === $statePath) {
    return false;
  }

  return true;
})
->visible(function (Component $component, Get $get) {
  if ($get('../../conditions') === null) {
    return false;
  }

  $statePath = $component->getContainer()->getStatePath();
  $statePath = explode('.', $statePath);
  $statePath = end($statePath);
  
  if (array_key_first($get('../../conditions')) === $statePath) {
    return false;
  }

  return true;
})


Best regards
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Repeater: show delete button on each line conditionally
FilamentFFilament / ❓┊help
3y ago
Change repeater field label based on other field value
FilamentFFilament / ❓┊help
16mo ago
Auto-populating a repeater based on another field
FilamentFFilament / ❓┊help
2y ago
Questions based on repeater
FilamentFFilament / ❓┊help
2y ago