Getting started with Filament 3.3 - Need beginner help with FORMS
I have Laravel 11 and I just installed filament forms and actions but having issues getting the most basic form created and displayed.
Do I add my code to a normal Laravel controller? Do I make a livewire component? Please help me get started with a basic example.
36 Replies
You would add the code to the livewire component.
@awcodes Ok I for further along, when I view the page the form field is not showing up properly. See screenshot.I am using Tailwind CSS in my project:
Looks like you’re missing the styles. That is all covered under the installation steps.
I ran those on my existing project, perhaps something may not be compatibile? Here is the first part of my tailwind.config.js:
app.css has:
postcss.config.js has:
And what about your layout, did you include the
@FilamentScripts
and @FilamentStyles
directives?app.blade.php:
base.blade.php
Hmm, maybe the livewire directives are creating a problem. They shouldn’t be needed with v3. Not sure. Nothing obvious is standing out based on what you shared.
Also, side note, why is the footer outside the body.?
I tried commenting out the @livewire directives, but still an issue. Thanks for pointing out the footer outside of body, I moved it back.
How can I make sure that the page i loading the filament CSS? What should I look for in the Network Tab of the browser?
Since you’re using it stand-alone it would be your app.css
Sounds like you possibly missed a step somewhere, but hard to say without seeing the app’s code.
Is there a specific element I can look for in the app.css to make sure the filament class is there?
Not really, it’s all tailwind classes.
Sigh...i was excited to give Filament a try, but I may just have to revert back and continue with something else
If you follow all the steps in the installation guide it would be working.
You just missed a step somewhere.
Is there anything else I need to do besides what is decribed in https://filamentphp.com/docs/3.x/forms/installation ? I'm not using the full filament library
I promise it works. I’m using it with no issues.
I have panels on the backend for our CMS. And am using the forms package individually on the front end with no issues for our lead gen forms.
Btw, I didn't already have livewire. I let composer install that dependency. Do I need ti install liverwire separately and follow their instructions?
All the packages work standalone. Just have to setup the app / layouts correctly.
No, requiring any of the filament packages will also require livewire.
It looks like everything you’re doing is correct. That’s why you’re seeing a browser validation error. It’s just something in your set up that is not creating the right classes for tailwinds’ jit compiler.
It’s not a filament issue. Just a misconfiguration in your app.
Do I use
php artisan make:livewire
when creating a basic filament form?Sure, that’s just going to make a livewire component.
But the layout for the page has to include filament styles and scripts.
Now, that could be a full page livewire component or not. It’s dependent to your app and what blade components are used.
It’s not necessarily filament specific.
I think you might need to spend some time understanding how livewire and tailwind work to get a better understanding of the ecosystem.
And we are certainly here to help, but there’s only so much we can offer.
You've been very helpful and I appreciate it. I re-installed everything and now using the exact "create-post" example. Still having CSS issues: I do't imagine that the default text color is white!
BTW - All my other Tailwind CSS on the page works fine.. Does that indicate anything?
That sounds like a missing config for the dark mode class on the html element.
I noticed that the input field has the class "dark:text-white "...Where is dark mode being set from?
In your tailwind.config.js
But your layout needs to handle the class.
Here is my tailwind.config.js: I don't see any mention of Dark Mode. I guess I'm confused, what do I need to handle? I don't want dark mode - my app does not support it (I don't think)
You’re missing the presets key in this config.
You’re importing it but not including it.
Can you point me to a doc that shows this step?
it works now btw, thank you so much for your help! Can you recommend a good site with full working examples/tutorials of Filament 3? (besides the official doc)
I’ve already posted it.
ahhh of course human error, I see it now. sigh..thanks for spending the time to find the issue
And the code is open sourced. https://github.com/filamentphp/demo
GitHub
GitHub - filamentphp/demo: Source code for the demo.filamentphp.com...
Source code for the demo.filamentphp.com website. Contribute to filamentphp/demo development by creating an account on GitHub.
Thank you - Is there a modal example there?