InfoList max width

How can I make my InfoList, which I'm defining in my ModelResource, take the screen whole width, as in MaxWidth::Full ?
public static function infolist(Infolist $infolist): Infolist
{
return $infolist
->schema([
TextEntry::make('host.name'),
TextEntry::make('event_type.name'),
TextEntry::make('timestamp'),
KeyValueEntry::make('data')
->label('Details')
->keyLabel('Key')
->valueLabel('Value')
->extraAttributes(['style' => 'word-wrap: anywhere'])
->getStateUsing(function (Event $record): array {
$details = [];
foreach ($record->data as $key => $value) {
if (is_array($value)) {
foreach ($value as $k => $v) {
$details[$k] = match (true) {
is_array($v) => json_encode($v),
default => $v,
};
}
}
}
ksort($details);

return $details;
}),
])
->columns(1)
->inlineLabel();
}
public static function infolist(Infolist $infolist): Infolist
{
return $infolist
->schema([
TextEntry::make('host.name'),
TextEntry::make('event_type.name'),
TextEntry::make('timestamp'),
KeyValueEntry::make('data')
->label('Details')
->keyLabel('Key')
->valueLabel('Value')
->extraAttributes(['style' => 'word-wrap: anywhere'])
->getStateUsing(function (Event $record): array {
$details = [];
foreach ($record->data as $key => $value) {
if (is_array($value)) {
foreach ($value as $k => $v) {
$details[$k] = match (true) {
is_array($v) => json_encode($v),
default => $v,
};
}
}
}
ksort($details);

return $details;
}),
])
->columns(1)
->inlineLabel();
}
Solution:
oh i see idk maybe try ```php...
Jump to solution
10 Replies
Matthew
Matthew3mo ago
In a page or modal ?
KingStalker
KingStalker3mo ago
do you want this
public function infolist(Infolist $infolist): Infolist
{
return $infolist
->state([
'host' => [
'name' => "John"
],
'event_type' => [
'name' => "my event"
],

"timestamp" => now()->toDateTimeString(),

"data" => [
'1' => 'value 1',
'2' => 'value 2',
'3' => 'value 3',
]

])
->schema([
Section::make()
->heading("example")
->description("this is an example")
->columns(3)
->schema([
TextEntry::make('host.name'),
TextEntry::make('event_type.name'),
TextEntry::make('timestamp')
->dateTime(),
KeyValueEntry::make('data')
->label('Details')
->keyLabel('Key')
->valueLabel('Value')
->extraAttributes(['style' => 'word-wrap: anywhere'])
->columnSpanFull(),


])

]);
}
public function infolist(Infolist $infolist): Infolist
{
return $infolist
->state([
'host' => [
'name' => "John"
],
'event_type' => [
'name' => "my event"
],

"timestamp" => now()->toDateTimeString(),

"data" => [
'1' => 'value 1',
'2' => 'value 2',
'3' => 'value 3',
]

])
->schema([
Section::make()
->heading("example")
->description("this is an example")
->columns(3)
->schema([
TextEntry::make('host.name'),
TextEntry::make('event_type.name'),
TextEntry::make('timestamp')
->dateTime(),
KeyValueEntry::make('data')
->label('Details')
->keyLabel('Key')
->valueLabel('Value')
->extraAttributes(['style' => 'word-wrap: anywhere'])
->columnSpanFull(),


])

]);
}
No description
titoshadow
titoshadowOP3mo ago
In a modal, the kind that opens with viewaction Nope, I'm afraid I'm talking about the base modal, not the key value entry
Solution
KingStalker
KingStalker3mo ago
oh i see idk maybe try
->modalWidth(MaxWidth::SevenExtraLarge) or ->modalWidth(MaxWidth::Full)
->modalWidth(MaxWidth::SevenExtraLarge) or ->modalWidth(MaxWidth::Full)
titoshadow
titoshadowOP3mo ago
I'm afraid that methods are not available when defining an InfoList within a Resource 😦 In CSS, this element width (at least, the one I want to control) is modified by .max-w-4xl
awcodes
awcodes3mo ago
Can you share a screenshot of what you are seeing?
titoshadow
titoshadowOP3mo ago
No description
Matthew
Matthew3mo ago
Haven't checked, but relatively sure those methods are available in the ViewAction
awcodes
awcodes3mo ago
Yep. That width is defined by the action since this is a modal.
titoshadow
titoshadowOP3mo ago
My bad, didnt understand you were refering to ViewAction, I was trying to get that from infoList method Got it right now ❤️
Want results from more Discord servers?
Add your server