F
Filament5mo ago
Noor

Css using wire:target or input type

How can I use css to change colors of actions correctly using wire target or input type . Because I tried to do iT did not worked out for me .
.dark .fi-modal-footer-actions .fi-btn [wire:target="callMountedTableAction"]{
background-color: rgba(var(--warning-400));
}
.dark .fi-modal-footer-actions .fi-btn [wire:target="callMountedTableAction"]{
background-color: rgba(var(--warning-400));
}
OR
.dark .fi-modal-footer-actions .fi-btn :input[type="submit"]{
background-color: rgba(var(--warning-400));
}
.dark .fi-modal-footer-actions .fi-btn :input[type="submit"]{
background-color: rgba(var(--warning-400));
}
27 Replies
Noor
Noor5mo ago
I appreciate if someone could help ty
awcodes
awcodes5mo ago
For a modal action something like this would work. [wire\:key*="open_curator_picker"] That wire:key will be on the modal itself. On your button example I’m not sure what you’re doing with :input why is there a colon in front of it? fi-btn isn’t an input it’s a button. So the input basically does nothing for targeting the button.
Noor
Noor5mo ago
but then if you don't specifically target the buttons it changes the color of every button I'm using I just want to change one button color
awcodes
awcodes5mo ago
why not just over ride the modal footer action and set the color there?
->modalSubmitAction(fn (StaticAction $action) => $action->color('warning'))
->modalSubmitAction(fn (StaticAction $action) => $action->color('warning'))
Noor
Noor5mo ago
but what if you want a different color for dark mode.. if I use extraAttributes that doesn't work for me specially if I try to change color
awcodes
awcodes5mo ago
then $action->extraAttributes(['class' => 'custom-class']) then target it in your css.
Noor
Noor5mo ago
->modalSubmitAction(fn (StaticAction $action) => $action->extraAttributes(['class'=>'action-color']))
->modalSubmitAction(fn (StaticAction $action) => $action->extraAttributes(['class'=>'action-color']))
.fi-btn .action-color .fi-ac-btn-action {
color : rgba(var(--warning-400));
}
.fi-btn .action-color .fi-ac-btn-action {
color : rgba(var(--warning-400));
}
NOT WORKING
awcodes
awcodes5mo ago
Look at the code in the html. Where is your action-color class being applied? If it’s on the same element as .fi-btn then your selector is wrong. In that case it should be .fi-btn.action-color. Also, your rgba() is missing the alpha value.
Noor
Noor5mo ago
alpha value missing .. what does that mean ?
awcodes
awcodes5mo ago
rgba(values, alpha) If you don’t need the opacity then it would just be rgb(values) or rgba(values, 0.7) for example.
Noor
Noor5mo ago
yes but I've already mentioned the hex color on panel
awcodes
awcodes5mo ago
Not a big deal though, rgba() probably defaults to 1 anyway.
Noor
Noor5mo ago
yes but I've already mentioned the hex color on panel and still not working
awcodes
awcodes5mo ago
Sorry, you lost me. What is your panel code to define the color. And what is the css you are using to target it?
Noor
Noor5mo ago
on panel 'warning' => Color::hex('#fb923c')
awcodes
awcodes5mo ago
Ok. And the css? Also a screen shot of the the html in devtools would help too. I don’t know where the extra attributes are applied on the action.
Noor
Noor5mo ago
@awcodes
Noor
Noor5mo ago
css
.dark .fi-modal-footer-actions .fi-btn .action-color {
background-color: rgba(var(--warning-400));
}
.dark .fi-modal-footer-actions .fi-btn .action-color {
background-color: rgba(var(--warning-400));
}
awcodes
awcodes5mo ago
I can’t open that file. My best guess is that something is off in your css selector. But I’m not sure what it is.
Noor
Noor5mo ago
I'm thinking the same but can not find out.. scratching my head since morning 😂
awcodes
awcodes5mo ago
Just look at the output html in devtools. That will tell you how to target it. That’s why I asked for a screenshot of it. I don’t know off the top of my head how it’s all output.
Noor
Noor5mo ago
It is working using !important
awcodes
awcodes5mo ago
sometimes it's necessary
Noor
Noor5mo ago
How do I do hover here
.dark .action-color :hover {
background-color: rgba(var(--warning-400));
}
.dark .action-color :hover {
background-color: rgba(var(--warning-400));
}
like this ?
awcodes
awcodes5mo ago
is .action-color on the actual button? if so
.dark .action-color:hover {}
.dark .action-color:hover {}
Noor
Noor5mo ago
action color is cutom class
.dark .fi-modal-footer-actions .action-color :hover {
background: rgba(var(--warning-300));
}
.dark .fi-modal-footer-actions .action-color :hover {
background: rgba(var(--warning-300));
}
so I tried this but its hovering label bg not full button
awcodes
awcodes5mo ago
I know it’s a custom class but is it on the actual button or not? You also need to have the :hover on an actual selector. Ie no space before it. That’s why I asked. It’s either .action-color:hover or .action-color button:hover. It matters what element the action-color class is on.
Want results from more Discord servers?
Add your server
More Posts
Trigger the collapse of a Form Section component when an input is filledHello everyone. I am using Filament version 3 and I am trying to implement a functionality concerninProblem loading multiple files FilamentHello everyone. I am using Filament version 3, and at a certain point, the file upload form stopped Table: SelectColumnI have a table column that uses SelectColumn, how can I trigger a confirmation/modal that shows a foOverride default precision of 2 digits alpine maskHi! I am using the alpine input mask, and it work fine! Is there a way to override the default preModify login screenHey all! I love using Filament but I was wondering about one thing. I want to modify the login page The afterValidation function is not functioning as expected in the last step of the wizard form.I am utilizing the filament wizard functionality in CreateAction. However, I am encountering an issuSearching for an image cropper editor compatible with v2im trying to find an image cropper form component compatible with filament v2 ive tried: https://v2how to prepare data for chart stat widgeti trying get value using array but only show index array 0 -12 ->chart($orderData Option to place introductionary help text on top of ressources?Hey, I aim for the control panel to be as self-explanatory as possible. Filament does a great job fCreating a Dashboard and can widgets on a dashboard be simple livewire components?I am trying to find the documentation for how to create a new Dashboard. And can simple livewire com