Setting a card-headline
Quick one (hopefully) - I'm trying to use the Card-Component via
Card::make()
which I wanna use to create a custom card. How do I set the headline for said card? ->label
seems not do to the trick...23 Replies
I think
Card
doesn't have a title but Section
doesYep! That works - thank you. 🙂
To not open again a thread - I have two more questions concerning custom-view-components.
1.) Is using
->viewdata(['variable' => $variable])
the intended way to send data to a custom component or am I doing unnecessary stuff here?
2.) Is it "good" practice to use <x-filament::whatever>-calls inside my custom view component or is this disencouraged?I don't really know about best practices tbh but I can say that I use both viewdata() and filament blade components extensively
I’m pretty sure cards have headings and a header.
Unless there is a difference between the Card widget and just a card.
Interestingly - I can set a heading when I use the
<x-filament::card>
-component inside a view, but not via Card::make
.
Well - since you use filament longer than I do, I guess it ain't that wrong. 😄 Thank you. 🙂Have you tried using “protected function getHeader()” or “protected function getHeading()” in the class?
Won't work here, since the card is used only as a partial within a Grid.
Oh yeah
Right now I'm sort of abusing the form-builder to build pages that have the only purpose of displaying informations...
Which is a bit confusing for newbies to the project, since I would guess that using
getFormSchema
is the way to do it, but to have a function like getPageSchema
which basically does the same, but has a different wording makes the code more easy to read. But that would be a comfort-feature I guess... 😄Regarding this question about using x-filament components in your view, i think that is fine because Filament does the same thing and plugins as well.
Thanks for that - I was scared that it might be disencouraged, since updates on said components could break stuff (like publishing the views is disencouraged for said reason). 🙂
If they change the view in the future you will just have to manually update it is all
Possibly. I think v3 will cause another rewrite anyhow... Seems like bad timing on starting with filament... 😄
Perhaps but all of us will have to rewrite things anyway, so your not alone.
Yay - shared suffering... Thanks... I guess? 🤣
Haha
I wouldn’t say it’s suffering though, just necessary and tedious… but that’s what coding is all about anyway
especially when you write your own SaaS... 😄
Yes especially when using 3rd party libraries and dependencies
Yep - But I come from "building everything on my own" and I think there it is worse sometimes.
Good thing is that I'm running everything on docker, so even if there is a break somewhere - I can fall back on a working image. 🙂
That’s good. Never really used docker. I usually just build and code locally as a hobby. But yeah “building everything on your own” is more work, but over time I have started to realize the more complex and highly specialized type of software application you have or want to build… building on your own is almost always necessary unfortunately.
You should really look into docker. It solves so many problems that occure on bare-metal (like what happens when one of your dependencies broke?) - even tho podman seems like a better way to start at the moment.
Of course you have to build your own stuff - otherwise AI could just replace us... 😄
Conversation moved to DMs. Ticket itself is resolved. Thanks people. 🙂
Uh - still got one more: Is there an easy way to pass an Icon to the Heading-Parameter aswell?
You can use the icon method on the Section:
Thank you! 😃