F
Filament10mo 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
NoorOP10mo ago
I appreciate if someone could help ty
awcodes
awcodes10mo 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
NoorOP10mo 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
awcodes10mo 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
NoorOP10mo 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
awcodes10mo ago
then $action->extraAttributes(['class' => 'custom-class']) then target it in your css.
Noor
NoorOP10mo 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
awcodes10mo 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
NoorOP10mo ago
alpha value missing .. what does that mean ?
awcodes
awcodes10mo 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
NoorOP10mo ago
yes but I've already mentioned the hex color on panel
awcodes
awcodes10mo ago
Not a big deal though, rgba() probably defaults to 1 anyway.
Noor
NoorOP10mo ago
yes but I've already mentioned the hex color on panel and still not working
awcodes
awcodes10mo 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
NoorOP10mo ago
on panel 'warning' => Color::hex('#fb923c')
awcodes
awcodes10mo 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
NoorOP10mo ago
@awcodes
Noor
NoorOP10mo 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
awcodes10mo 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
NoorOP10mo ago
I'm thinking the same but can not find out.. scratching my head since morning 😂
awcodes
awcodes10mo 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
NoorOP10mo ago
It is working using !important
awcodes
awcodes10mo ago
sometimes it's necessary
Noor
NoorOP10mo 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
awcodes10mo ago
is .action-color on the actual button? if so
.dark .action-color:hover {}
.dark .action-color:hover {}
Noor
NoorOP10mo 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
awcodes10mo 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