Overview
Entry classes can be found in theFilament\Infolists\Components namespace. You can put them inside the $infolist->schema() method:
infolist() method should be static:
make() method, passing its unique name. You may use “dot notation” to access entries within relationships.
Available entries
You may also create your own custom entries to display data however you wish.Setting a label
By default, the label of the entry, which is displayed in the header of the infolist, is generated from the name of the entry. You may customize this using thelabel() method:
translateLabel() method:
Entry URLs
When an entry is clicked, you may open a URL.Opening URLs
To open a URL, you may use theurl() method, passing a callback or static URL to open. Callbacks accept a $record parameter which you may use to customize the URL:
Setting a default value
To set a default value for entries with an empty state, you may use thedefault() method. This method will treat the default state as if it were real, so entries like image or color will display the default image or color.
Adding placeholder text if an entry is empty
Sometimes you may want to display placeholder text for entries with an empty state, which is styled as a lighter gray text. This differs from the default value, as the placeholder is always text and not treated as if it were real state.Adding helper text below the entry
Sometimes, you may wish to provide extra information for the user of the infolist. For this purpose, you may add helper text below the entry. ThehelperText() method is used to add helper text:
Illuminate\Support\HtmlString or Illuminate\Contracts\Support\Htmlable. This allows you to render HTML, or even markdown, in the helper text:
Adding a hint next to the label
As well as helper text below the entry, you may also add a “hint” next to the label of the entry. This is useful for displaying additional information about the entry, such as a link to a help page. Thehint() method is used to add a hint:
Illuminate\Support\HtmlString or Illuminate\Contracts\Support\Htmlable. This allows you to render HTML, or even markdown, in the helper text:
Changing the text color of the hint
You can change the text color of the hint. By default, it’s gray, but you may usedanger, info, primary, success and warning:
Adding an icon aside the hint
Hints may also have an icon rendered next to them:Adding a tooltip to a hint icon
Additionally, you can add a tooltip to display when you hover over the hint icon, using thetooltip parameter of hintIcon():
Hiding entries
To hide an entry conditionally, you may use thehidden() and visible() methods, whichever you prefer:
Calculated state
Sometimes you need to calculate the state of an entry, instead of directly reading it from a database entry. By passing a callback function to thestate() method, you can customize the returned state for that entry:
Tooltips
You may specify a tooltip to display when you hover over an entry:Custom attributes
The HTML of entries can be customized, by passing an array ofextraAttributes():
<div> element of each entry in that entry.
You can also pass extra HTML attributes to the entry wrapper which surrounds the label, entry, and any other text:
Global settings
If you wish to change the default behavior of all entries globally, then you can call the staticconfigureUsing() method inside a service provider’s boot() method, to which you pass a Closure to modify the entries using. For example, if you wish to make all TextEntry components words(10), you can do it like so: